Port to MC 1.20

This commit is contained in:
Jonas Herzig
2023-06-12 09:39:48 +02:00
parent 96a05e256f
commit 7726550131
14 changed files with 90 additions and 11 deletions

View File

@@ -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

View File

@@ -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();
}

View File

@@ -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

View File

@@ -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();
}

View File

@@ -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