Port to MC 1.20
This commit is contained in:
@@ -897,4 +897,13 @@ class Patterns {
|
||||
//#else
|
||||
//$$ @Pattern private static void REGISTRIES() {}
|
||||
//#endif
|
||||
|
||||
@Pattern
|
||||
public World getWorld(Entity entity) {
|
||||
//#if MC>=12000
|
||||
//$$ return entity.getWorld();
|
||||
//#else
|
||||
return entity.world;
|
||||
//#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,12 +9,17 @@ import de.johni0702.minecraft.gui.versions.callbacks.RenderHudCallback;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
||||
import static com.replaymod.core.ReplayMod.TEXTURE;
|
||||
import static com.replaymod.core.ReplayMod.TEXTURE_SIZE;
|
||||
import static com.mojang.blaze3d.platform.GlStateManager.*;
|
||||
|
||||
//#if MC>=12000
|
||||
//$$ import net.minecraft.client.gui.DrawContext;
|
||||
//#else
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
//#endif
|
||||
|
||||
/**
|
||||
* Renders overlay during recording.
|
||||
*/
|
||||
@@ -33,7 +38,11 @@ public class GuiRecordingOverlay extends EventRegistrations {
|
||||
* Render the recording icon and text in the top left corner of the screen.
|
||||
*/
|
||||
{ on(RenderHudCallback.EVENT, (stack, partialTicks) -> renderRecordingIndicator(stack)); }
|
||||
//#if MC>=12000
|
||||
//$$ private void renderRecordingIndicator(DrawContext stack) {
|
||||
//#else
|
||||
private void renderRecordingIndicator(MatrixStack stack) {
|
||||
//#endif
|
||||
if (guiControls.isStopped()) return;
|
||||
if (settingsRegistry.get(Setting.INDICATOR)) {
|
||||
TextRenderer fontRenderer = mc.textRenderer;
|
||||
|
||||
@@ -27,6 +27,9 @@ import net.minecraft.client.render.WorldRenderer;
|
||||
public abstract class Mixin_ChromaKeyForceSky {
|
||||
@Shadow @Final private MinecraftClient client;
|
||||
|
||||
//#if MC>=11700
|
||||
//$$ // Sky appears to be rendered unconditionally now
|
||||
//#else
|
||||
//#if MC>=11500
|
||||
@ModifyConstant(method = "render", constant = @Constant(intValue = 4))
|
||||
//#elseif MC>=11400
|
||||
@@ -44,4 +47,5 @@ public abstract class Mixin_ChromaKeyForceSky {
|
||||
}
|
||||
return value;
|
||||
}
|
||||
//#endif
|
||||
}
|
||||
|
||||
@@ -41,6 +41,11 @@ import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.client.render.RenderTickCounter;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
//#if MC>=12000
|
||||
//$$ import com.mojang.blaze3d.systems.VertexSorter;
|
||||
//$$ import net.minecraft.client.gui.DrawContext;
|
||||
//#endif
|
||||
|
||||
//#if MC>=11700
|
||||
//$$ import net.minecraft.client.render.DiffuseLighting;
|
||||
//$$ import net.minecraft.util.math.Matrix4f;
|
||||
@@ -492,7 +497,11 @@ public class VideoRenderer implements RenderInfo {
|
||||
//$$ (float) (window.getFramebufferHeight() / window.getScaleFactor()),
|
||||
//$$ 1000,
|
||||
//$$ 3000
|
||||
//$$ ));
|
||||
//$$ )
|
||||
//#if MC>=12000
|
||||
//$$ , VertexSorter.BY_Z
|
||||
//#endif
|
||||
//$$ );
|
||||
//$$ MatrixStack matrixStack = RenderSystem.getModelViewStack();
|
||||
//$$ matrixStack.loadIdentity();
|
||||
//$$ matrixStack.translate(0, 0, -2000);
|
||||
@@ -544,7 +553,9 @@ public class VideoRenderer implements RenderInfo {
|
||||
try {
|
||||
mc.currentScreen = gui.toMinecraft();
|
||||
mc.getOverlay().render(
|
||||
//#if MC>=11600
|
||||
//#if MC>=12000
|
||||
//$$ new DrawContext(mc, mc.getBufferBuilders().getEntityVertexConsumers()),
|
||||
//#elseif MC>=11600
|
||||
new MatrixStack(),
|
||||
//#endif
|
||||
mouseX, mouseY, 0);
|
||||
@@ -554,7 +565,9 @@ public class VideoRenderer implements RenderInfo {
|
||||
} else {
|
||||
gui.toMinecraft().tick();
|
||||
gui.toMinecraft().render(
|
||||
//#if MC>=11600
|
||||
//#if MC>=12000
|
||||
//$$ new DrawContext(mc, mc.getBufferBuilders().getEntityVertexConsumers()),
|
||||
//#elseif MC>=11600
|
||||
new MatrixStack(),
|
||||
//#endif
|
||||
mouseX, mouseY, 0);
|
||||
|
||||
@@ -440,7 +440,11 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
|
||||
//#endif
|
||||
LightingProvider provider = world.getChunkManager().getLightingProvider();
|
||||
while (provider.hasUpdates()) {
|
||||
//#if MC>=12000
|
||||
//$$ provider.doLightUpdates();
|
||||
//#else
|
||||
provider.doLightUpdates(Integer.MAX_VALUE, true, true);
|
||||
//#endif
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -712,6 +716,9 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
|
||||
//#if MC>=11900
|
||||
//$$ , java.util.Optional.empty()
|
||||
//#endif
|
||||
//#if MC>=12000
|
||||
//$$ , packet.portalCooldown()
|
||||
//#endif
|
||||
);
|
||||
//#else
|
||||
//#if MC>=10800
|
||||
@@ -775,6 +782,9 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
|
||||
//#if MC>=11900
|
||||
//$$ , java.util.Optional.empty()
|
||||
//#endif
|
||||
//#if MC>=12000
|
||||
//$$ , respawn.getPortalCooldown()
|
||||
//#endif
|
||||
);
|
||||
//#else
|
||||
//#if MC>=10809
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.replaymod.core.utils.WrappedTimer;
|
||||
import com.replaymod.core.versions.MCVer;
|
||||
import com.replaymod.replay.camera.CameraController;
|
||||
import com.replaymod.replay.camera.CameraEntity;
|
||||
import de.johni0702.minecraft.gui.versions.ScreenExt;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.RenderTickCounter;
|
||||
|
||||
@@ -78,7 +79,7 @@ public class InputReplayTimer extends WrappedTimer {
|
||||
// tick speed may vary or there may not be any ticks at all (when the replay is paused)
|
||||
if (mod.getReplayHandler() != null && mc.world != null && mc.player != null) {
|
||||
//#if MC>=11400
|
||||
if (mc.currentScreen == null || mc.currentScreen.passEvents) {
|
||||
if (mc.currentScreen == null || ((ScreenExt) mc.currentScreen).doesPassEvents()) {
|
||||
GLFW.glfwPollEvents();
|
||||
MCVer.processKeyBinds();
|
||||
}
|
||||
|
||||
@@ -42,6 +42,11 @@ import net.minecraft.network.ClientConnection;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
//#if MC>=12000
|
||||
//$$ import com.mojang.blaze3d.systems.VertexSorter;
|
||||
//$$ import net.minecraft.client.gui.DrawContext;
|
||||
//#endif
|
||||
|
||||
//#if MC>=11904
|
||||
//$$ import net.minecraft.network.PacketBundler;
|
||||
//#endif
|
||||
@@ -653,7 +658,11 @@ public class ReplayHandler {
|
||||
//$$ (float) (window.getFramebufferHeight() / window.getScaleFactor()),
|
||||
//$$ 1000,
|
||||
//$$ 3000
|
||||
//$$ ));
|
||||
//$$ )
|
||||
//#if MC>=12000
|
||||
//$$ , VertexSorter.BY_Z
|
||||
//#endif
|
||||
//$$ );
|
||||
//$$ MatrixStack matrixStack = RenderSystem.getModelViewStack();
|
||||
//$$ matrixStack.loadIdentity();
|
||||
//$$ matrixStack.translate(0, 0, -2000);
|
||||
@@ -676,7 +685,9 @@ public class ReplayHandler {
|
||||
//#endif
|
||||
|
||||
guiScreen.toMinecraft().init(mc, window.getScaledWidth(), window.getScaledHeight());
|
||||
//#if MC>=11600
|
||||
//#if MC>=12000
|
||||
//$$ guiScreen.toMinecraft().render(new DrawContext(mc, mc.getBufferBuilders().getEntityVertexConsumers()), 0, 0, 0);
|
||||
//#elseif MC>=11600
|
||||
guiScreen.toMinecraft().render(new MatrixStack(), 0, 0, 0);
|
||||
//#else
|
||||
//#if MC>=11400
|
||||
|
||||
@@ -332,7 +332,12 @@ public class CameraEntity
|
||||
public void afterSpawn() {
|
||||
// Make sure our world is up-to-date in case of world changes
|
||||
if (this.client.world != null) {
|
||||
// FIXME cannot use Patters because `setWorld` is `protected` in 1.20
|
||||
//#if MC>=12000
|
||||
//$$ this.setWorld(this.client.world);
|
||||
//#else
|
||||
this.world = this.client.world;
|
||||
//#endif
|
||||
}
|
||||
super.afterSpawn();
|
||||
}
|
||||
|
||||
@@ -16,6 +16,10 @@ import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.widget.AbstractButtonWidget;
|
||||
|
||||
//#if MC>=12000
|
||||
//$$ import net.minecraft.client.gui.DrawContext;
|
||||
//#endif
|
||||
|
||||
//#if MC>=11904
|
||||
//#else
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
@@ -316,7 +320,10 @@ public class GuiHandler extends EventRegistrations {
|
||||
this::onButton
|
||||
) {
|
||||
@Override
|
||||
//#if MC>=11904
|
||||
//#if MC>=12000
|
||||
//$$ public void renderButton(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
//$$ super.renderButton(context, mouseX, mouseY, delta);
|
||||
//#elseif MC>=11904
|
||||
//$$ public void renderButton(MatrixStack context, int mouseX, int mouseY, float delta) {
|
||||
//$$ super.renderButton(context, mouseX, mouseY, delta);
|
||||
//#else
|
||||
|
||||
Reference in New Issue
Block a user