Update to 1.20.6

This commit is contained in:
Jonas Herzig
2024-06-18 14:48:26 +02:00
parent 3f12413c6b
commit 5218feb6b6
33 changed files with 424 additions and 25 deletions

View File

@@ -183,6 +183,9 @@ public class Util {
}
public static String getTileEntityId(BlockEntity tileEntity) {
//#if MC>=12006
//$$ return net.minecraft.block.entity.BlockEntityType.getId(tileEntity.getType()).toString();
//#else
//#if MC>=11800
//$$ NbtCompound nbt = tileEntity.createNbt();
//#else
@@ -194,6 +197,7 @@ public class Util {
//#endif
//#endif
return nbt.getString("id");
//#endif
}
public interface IOCallable<R> {

View File

@@ -112,7 +112,13 @@ public class GuiVideoRenderer extends GuiScreen implements Tickable {
size(contentPanel, width - 10, height - 10);
}
});
// FIXME default background doesn't work during rendering because the blur effect relies on the framebuffer
//#if MC>=12006
//$$ setBackground(Background.NONE);
//$$ setBackgroundColor(new de.johni0702.minecraft.gui.utils.lwjgl.Color(32, 32, 32));
//#else
setBackground(Background.DIRT);
//#endif
}
public GuiVideoRenderer(VideoRenderer renderer) {

View File

@@ -22,7 +22,9 @@ public abstract class Mixin_ChromaKeyColorSky {
//#if MC>=11800
//$$ @Inject(
//#if MC>=11802
//#if MC>=12005
//$$ method = "renderSky(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;FLnet/minecraft/client/render/Camera;ZLjava/lang/Runnable;)V",
//#elseif MC>=11802
//$$ method = "renderSky(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/util/math/Matrix4f;FLnet/minecraft/client/render/Camera;ZLjava/lang/Runnable;)V",
//#else
//$$ method = "renderSky(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/util/math/Matrix4f;FLjava/lang/Runnable;)V",

View File

@@ -11,7 +11,11 @@ import org.spongepowered.asm.mixin.injection.ModifyArg;
public abstract class Mixin_Omnidirectional_Camera implements EntityRendererHandler.IEntityRenderer {
private static final String METHOD = "getBasicProjectionMatrix";
//#if MC>=11903
//#if MC>=12005
//$$ private static final String TARGET = "Lorg/joml/Matrix4f;perspective(FFFF)Lorg/joml/Matrix4f;";
//#else
//$$ private static final String TARGET = "Lorg/joml/Matrix4f;setPerspective(FFFF)Lorg/joml/Matrix4f;";
//#endif
//$$ private static final boolean TARGET_REMAP = false;
//$$ private static final float OMNIDIRECTIONAL_FOV = (float) Math.PI / 2;
//#else

View File

@@ -7,6 +7,11 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
//#if MC>=12005
//$$ import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
//$$ import org.joml.Matrix4f;
//#endif
//#if MC>=11500
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f;
@@ -30,6 +35,10 @@ public abstract class Mixin_Omnidirectional_Rotation {
return ((EntityRendererHandler.IEntityRenderer) getMinecraft().gameRenderer).replayModRender_getHandler();
}
//#if MC>=12005
//$$ @ModifyExpressionValue(method = "renderWorld", at = @At(value = "INVOKE", target = "Lorg/joml/Matrix4f;rotationXYZ(FFF)Lorg/joml/Matrix4f;"))
//$$ private Matrix4f replayModRender_setupCubicFrameRotation(Matrix4f matrix) {
//#else
//#if MC>=11500
@Inject(method = "renderWorld", at = @At("HEAD"))
//#else
@@ -47,6 +56,7 @@ public abstract class Mixin_Omnidirectional_Rotation {
//#endif
CallbackInfo ci
) {
//#endif
if (getHandler() != null && getHandler().data instanceof CubicOpenGlFrameCapturer.Data) {
CubicOpenGlFrameCapturer.Data data = (CubicOpenGlFrameCapturer.Data) getHandler().data;
float angle = 0;
@@ -78,7 +88,9 @@ public abstract class Mixin_Omnidirectional_Rotation {
x = 1;
break;
}
//#if MC>=11500
//#if MC>=12005
//$$ matrix.rotateLocal(angle * (float) Math.PI / 180f, x, y, 0);
//#elseif MC>=11500
matrixStack.multiply(new Vector3f(x, y, 0).getDegreesQuaternion(angle));
//#else
//$$ GL11.glRotatef(angle, x, y, 0);
@@ -96,5 +108,8 @@ public abstract class Mixin_Omnidirectional_Rotation {
//#endif
//$$ }
//#endif
//#if MC>=12005
//$$ return matrix;
//#endif
}
}

View File

@@ -11,6 +11,11 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
//#if MC>=12005
//$$ import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
//$$ import org.joml.Matrix4f;
//#endif
@Mixin(GameRenderer.class)
public abstract class Mixin_Stereoscopic_Camera implements EntityRendererHandler.IEntityRenderer {
@Inject(method = "getBasicProjectionMatrix", at = @At("RETURN"), cancellable = true)
@@ -29,14 +34,30 @@ public abstract class Mixin_Stereoscopic_Camera implements EntityRendererHandler
}
}
//#if MC>=12005
//$$ @ModifyExpressionValue(method = "renderWorld", at = @At(value = "INVOKE", target = "Lorg/joml/Matrix4f;rotationXYZ(FFF)Lorg/joml/Matrix4f;"))
//$$ private Matrix4f replayModRender_setupStereoscopicProjection(Matrix4f matrix) {
//#else
@Inject(method = "renderWorld", at = @At("HEAD"))
private void replayModRender_setupStereoscopicProjection(float partialTicks, long frameStartNano, MatrixStack matrixStack, CallbackInfo ci) {
//#endif
if (replayModRender_getHandler() != null) {
if (replayModRender_getHandler().data == StereoscopicOpenGlFrameCapturer.Data.LEFT_EYE) {
matrixStack.translate(0.1, 0, 0);
//#if MC>=12005
//$$ matrix.translateLocal(0.1f, 0, 0);
//#else
matrixStack.translate(0.1f, 0, 0);
//#endif
} else if (replayModRender_getHandler().data == StereoscopicOpenGlFrameCapturer.Data.RIGHT_EYE) {
matrixStack.translate(-0.1, 0, 0);
//#if MC>=12005
//$$ matrix.translateLocal(-0.1f, 0, 0);
//#else
matrixStack.translate(-0.1f, 0, 0);
//#endif
}
}
//#if MC>=12005
//$$ return matrix;
//#endif
}
}

View File

@@ -512,9 +512,14 @@ public class VideoRenderer implements RenderInfo {
//$$ , VertexSorter.BY_Z
//#endif
//$$ );
//#if MC>=12006
//$$ org.joml.Matrix4fStack matrixStack = RenderSystem.getModelViewStack();
//$$ matrixStack.translation(0, 0, -2000);
//#else
//$$ MatrixStack matrixStack = RenderSystem.getModelViewStack();
//$$ matrixStack.loadIdentity();
//$$ matrixStack.translate(0, 0, -2000);
//#endif
//$$ RenderSystem.applyModelViewMatrix();
//$$ DiffuseLighting.enableGuiDepthLighting();
//#else
@@ -558,13 +563,17 @@ public class VideoRenderer implements RenderInfo {
int mouseX = (int) mc.mouse.getX() * window.getScaledWidth() / Math.max(window.getWidth(), 1);
int mouseY = (int) mc.mouse.getY() * window.getScaledHeight() / Math.max(window.getHeight(), 1);
//#if MC>=12000
//$$ DrawContext drawContext = new DrawContext(mc, mc.getBufferBuilders().getEntityVertexConsumers());
//#endif
if (mc.getOverlay() != null) {
Screen orgScreen = mc.currentScreen;
try {
mc.currentScreen = gui.toMinecraft();
mc.getOverlay().render(
//#if MC>=12000
//$$ new DrawContext(mc, mc.getBufferBuilders().getEntityVertexConsumers()),
//$$ drawContext,
//#elseif MC>=11600
new MatrixStack(),
//#endif
@@ -582,6 +591,9 @@ public class VideoRenderer implements RenderInfo {
//#endif
mouseX, mouseY, 0);
}
//#if MC>=12000
//$$ drawContext.draw();
//#endif
//#else
//$$ int mouseX = Mouse.getX() * window.getScaledWidth() / mc.displayWidth;
//$$ int mouseY = window.getScaledHeight() - Mouse.getY() * window.getScaledHeight() / mc.displayHeight - 1;