Port to MC 1.18.2 (closes #697)

This commit is contained in:
Jonas Herzig
2022-03-06 12:33:13 +01:00
parent 1fa027f362
commit 4aa667fe04
12 changed files with 60 additions and 8 deletions

View File

@@ -33,7 +33,9 @@ public abstract class MixinMouseHelper {
long _p0, double _p1, double _p2,
CallbackInfo ci,
double _l1,
//#if MC>=11400
//#if MC>=11802
//$$ int yOffsetAccumulated
//#elseif MC>=11400
float yOffsetAccumulated
//#else
//$$ double yOffsetAccumulated

View File

@@ -16,6 +16,10 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
//#if MC>=11802
//$$ import net.minecraft.util.registry.RegistryEntry;
//#endif
//#if MC>=11600
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.MutableWorldProperties;
@@ -52,7 +56,12 @@ public abstract class MixinWorldClient extends World implements RecordingEventHa
//#if MC<11602
//$$ RegistryKey<DimensionType> registryKey2,
//#endif
DimensionType dimensionType, Supplier<Profiler> profiler, boolean bl, boolean bl2, long l) {
//#if MC>=11802
//$$ RegistryEntry<DimensionType> dimensionType,
//#else
DimensionType dimensionType,
//#endif
Supplier<Profiler> profiler, boolean bl, boolean bl2, long l) {
super(mutableWorldProperties, registryKey,
//#if MC<11602
//$$ registryKey2,

View File

@@ -21,7 +21,12 @@ public abstract class Mixin_ChromaKeyColorSky {
@Shadow @Final private MinecraftClient client;
//#if MC>=11800
//$$ @Inject(method = "renderSky(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/util/math/Matrix4f;FLjava/lang/Runnable;)V",
//$$ @Inject(
//#if 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",
//#endif
//$$ at = @At(value = "INVOKE", target = "Ljava/lang/Runnable;run()V", remap = false, shift = At.Shift.AFTER),
//$$ cancellable = true)
//#elseif MC>=11400 || 10710>=MC

View File

@@ -648,7 +648,11 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
//#if MC>=11600
//#if MC>=11603
packet.getDimensionIds(),
//#if MC>=11800
//$$ packet.registryManager(),
//#else
(net.minecraft.util.registry.DynamicRegistryManager.Impl) packet.getRegistryManager(),
//#endif
packet.getDimensionType(),
//#else
//$$ packet.method_29443(),

View File

@@ -8,6 +8,10 @@ import com.replaymod.replay.camera.CameraEntity;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.RenderTickCounter;
//#if MC>=11802
//$$ import net.minecraft.client.gui.screen.DownloadingTerrainScreen;
//#endif
//#if MC>=11400
import org.lwjgl.glfw.GLFW;
//#else
@@ -111,6 +115,15 @@ public class InputReplayTimer extends WrappedTimer {
//#endif
//$$ }
//#endif
//#if MC>=11802
//$$ // As of 1.18.2, this screen always stays open for at least two seconds, and requires ticking to close.
//$$ // Thanks, but we'll have none of that (at least while in a replay).
//$$ if (mc.currentScreen instanceof DownloadingTerrainScreen) {
//$$ mc.currentScreen.close();
//$$ }
//#endif
}
//#if MC>=11600
return ticksThisFrame;

View File

@@ -31,6 +31,10 @@ import net.minecraft.stat.StatHandler;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.Box;
//#if MC>=11802
//$$ import net.minecraft.tag.TagKey;
//#endif
//#if FABRIC>=1
//#else
//$$ import net.minecraftforge.client.event.EntityViewRenderEvent;
@@ -354,7 +358,13 @@ public class CameraEntity
//#if MC>=11400
@Override
public boolean isSubmergedIn(Tag<Fluid> fluid) {
public boolean isSubmergedIn(
//#if MC>=11802
//$$ TagKey<Fluid> fluid
//#else
Tag<Fluid> fluid
//#endif
) {
return falseUnlessSpectating(entity -> entity.isSubmergedIn(fluid));
}

View File

@@ -18,7 +18,7 @@ public abstract class MixinGuiSpectator {
//$$ @Inject(method = "func_175260_a", at = @At("HEAD"), cancellable = true)
//#endif
public void isInReplay(
//#if MC>=11400
//#if MC>=11400 && MC<11802
double i,
//#else
//$$ int i,