diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/access/IDownloadingTerrainScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/access/IDownloadingTerrainScreen.java index d8b09443..f91ae7ba 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/access/IDownloadingTerrainScreen.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/access/IDownloadingTerrainScreen.java @@ -23,6 +23,4 @@ public interface IDownloadingTerrainScreen { void viaFabricPlus$setReady(); - boolean viaFabricPlus$isReady(); - } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinClientPlayNetworkHandler.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinClientPlayNetworkHandler.java index 76c6797c..4069a9c4 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinClientPlayNetworkHandler.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinClientPlayNetworkHandler.java @@ -121,17 +121,15 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH @Inject(method = "onPlayerSpawnPosition", at = @At("RETURN")) public void moveDownloadingTerrainClosing(PlayerSpawnPositionS2CPacket packet, CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().isBetweenInclusive(VersionEnum.r1_19, VersionEnum.r1_20_2)) { - if (this.client.currentScreen instanceof DownloadingTerrainScreen downloadingTerrainScreen) { - ((IDownloadingTerrainScreen) downloadingTerrainScreen).viaFabricPlus$setReady(); - } + if (ProtocolHack.getTargetVersion().isBetweenInclusive(VersionEnum.r1_19, VersionEnum.r1_20_2) && this.client.currentScreen instanceof IDownloadingTerrainScreen mixinDownloadingTerrainScreen) { + mixinDownloadingTerrainScreen.viaFabricPlus$setReady(); } } @Inject(method = "onPlayerPositionLook", at = @At("RETURN")) private void closeDownloadingTerrain(PlayerPositionLookS2CPacket packet, CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_18tor1_18_1) && this.client.currentScreen instanceof DownloadingTerrainScreen downloadingTerrainScreen) { - ((IDownloadingTerrainScreen) downloadingTerrainScreen).viaFabricPlus$setReady(); + if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_18tor1_18_1) && this.client.currentScreen instanceof IDownloadingTerrainScreen mixinDownloadingTerrainScreen) { + mixinDownloadingTerrainScreen.viaFabricPlus$setReady(); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinDownloadingTerrainScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinDownloadingTerrainScreen.java index cde9bee0..381a5cdb 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinDownloadingTerrainScreen.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinDownloadingTerrainScreen.java @@ -47,7 +47,7 @@ public abstract class MixinDownloadingTerrainScreen extends Screen implements ID private int viaFabricPlus$tickCounter; @Unique - private boolean viaFabricPlus$isReady; + private boolean viaFabricPlus$ready; @Unique private boolean viaFabricPlus$closeOnNextTick = false; @@ -73,15 +73,15 @@ public abstract class MixinDownloadingTerrainScreen extends Screen implements ID } } else { if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_1tor1_19_2)) { - this.viaFabricPlus$closeOnNextTick = this.viaFabricPlus$isReady || System.currentTimeMillis() > this.loadStartTime + 2000; + this.viaFabricPlus$closeOnNextTick = this.viaFabricPlus$ready || System.currentTimeMillis() > this.loadStartTime + 2000; } else { - this.viaFabricPlus$closeOnNextTick = this.viaFabricPlus$isReady; + this.viaFabricPlus$closeOnNextTick = this.viaFabricPlus$ready; } } } if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_18tor1_18_1)) { - if (this.viaFabricPlus$isReady) { + if (this.viaFabricPlus$ready) { this.close(); } @@ -95,14 +95,9 @@ public abstract class MixinDownloadingTerrainScreen extends Screen implements ID } } - @Override - public boolean viaFabricPlus$isReady() { - return viaFabricPlus$isReady; - } - @Override public void viaFabricPlus$setReady() { - viaFabricPlus$isReady = true; + viaFabricPlus$ready = true; } }