diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinGameModeSelectionScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinGameModeSelectionScreen.java index 6ed8ba3b..5fe4c71e 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinGameModeSelectionScreen.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinGameModeSelectionScreen.java @@ -50,8 +50,12 @@ public class MixinGameModeSelectionScreen extends Screen { if (ProtocolHack.getTargetVersion().isOlderThan(VersionEnum.r1_8)) { final List gameModeSelections = new ArrayList<>(Arrays.stream(GameModeSelectionScreen.GameModeSelection.values()).toList()); - if (ProtocolHack.getTargetVersion().isOlderThan(VersionEnum.r1_3_1tor1_3_2)) gameModeSelections.remove(GameModeSelectionScreen.GameModeSelection.ADVENTURE); - if (ProtocolHack.getTargetVersion().isOlderThan(VersionEnum.r1_8)) gameModeSelections.remove(GameModeSelectionScreen.GameModeSelection.SPECTATOR); + if (ProtocolHack.getTargetVersion().isOlderThan(VersionEnum.r1_3_1tor1_3_2)) { + gameModeSelections.remove(GameModeSelectionScreen.GameModeSelection.ADVENTURE); + } + if (ProtocolHack.getTargetVersion().isOlderThan(VersionEnum.r1_8)) { + gameModeSelections.remove(GameModeSelectionScreen.GameModeSelection.SPECTATOR); + } viafabricplus_unwrappedGameModes = gameModeSelections.toArray(GameModeSelectionScreen.GameModeSelection[]::new); UI_WIDTH = viafabricplus_unwrappedGameModes.length * 31 - 5; diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinGameModeSelectionScreen_GameModeSelection.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinGameModeSelectionScreen_GameModeSelection.java index 1f718ee8..55201022 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinGameModeSelectionScreen_GameModeSelection.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinGameModeSelectionScreen_GameModeSelection.java @@ -52,18 +52,18 @@ public class MixinGameModeSelectionScreen_GameModeSelection { } @Inject(method = "next", at = @At("HEAD"), cancellable = true) - public void unwrapGameModes(CallbackInfoReturnable> cir) { + private void unwrapGameModes(CallbackInfoReturnable cir) { if (ProtocolHack.getTargetVersion().isOlderThan(VersionEnum.r1_8)) { - switch ((GameModeSelectionScreen.GameModeSelection)(Object)this) { - case CREATIVE -> cir.setReturnValue(Optional.of(SURVIVAL)); + switch ((GameModeSelectionScreen.GameModeSelection) (Object) this) { + case CREATIVE -> cir.setReturnValue(SURVIVAL); case SURVIVAL -> { - if (ProtocolHack.getTargetVersion().isOlderThan(VersionEnum.r1_2_4tor1_2_5)) { - cir.setReturnValue(Optional.of(CREATIVE)); + if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_2_4tor1_2_5)) { + cir.setReturnValue(CREATIVE); } else { - cir.setReturnValue(Optional.of(GameModeSelectionScreen.GameModeSelection.ADVENTURE)); + cir.setReturnValue(GameModeSelectionScreen.GameModeSelection.ADVENTURE); } } - case ADVENTURE -> cir.setReturnValue(Optional.of(CREATIVE)); + case ADVENTURE -> cir.setReturnValue(CREATIVE); } } }