mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-09-06 01:07:59 +02:00
Merge remote-tracking branch 'origin/main' into recode/3.0.0
# Conflicts: # src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinGameModeSelectionScreen.java # src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinGameModeSelectionScreen_GameModeSelection.java
This commit is contained in:
commit
ae6e117698
@ -51,11 +51,13 @@ public abstract class MixinGameModeSelectionScreen extends Screen {
|
||||
|
||||
@Inject(method = "<init>", at = @At("RETURN"))
|
||||
private void fixUIWidth(CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThan(VersionEnum.r1_8)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_7_6tor1_7_10)) {
|
||||
final List<GameModeSelectionScreen.GameModeSelection> 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);
|
||||
gameModeSelections.remove(GameModeSelectionScreen.GameModeSelection.SPECTATOR);
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_2_4tor1_2_5)) {
|
||||
gameModeSelections.remove(GameModeSelectionScreen.GameModeSelection.ADVENTURE);
|
||||
}
|
||||
|
||||
viaFabricPlus$unwrappedGameModes = gameModeSelections.toArray(GameModeSelectionScreen.GameModeSelection[]::new);
|
||||
UI_WIDTH = viaFabricPlus$unwrappedGameModes.length * 31 - 5;
|
||||
@ -64,7 +66,7 @@ public abstract class MixinGameModeSelectionScreen extends Screen {
|
||||
|
||||
@Redirect(method = "init", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screen/GameModeSelectionScreen$GameModeSelection;VALUES:[Lnet/minecraft/client/gui/screen/GameModeSelectionScreen$GameModeSelection;"))
|
||||
private GameModeSelectionScreen.GameModeSelection[] removeNewerGameModes() {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThan(VersionEnum.r1_8)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_7_6tor1_7_10)) {
|
||||
return viaFabricPlus$unwrappedGameModes;
|
||||
}
|
||||
|
||||
|
@ -45,18 +45,18 @@ public abstract class MixinGameModeSelectionScreen_GameModeSelection {
|
||||
public static GameModeSelectionScreen.GameModeSelection CREATIVE;
|
||||
|
||||
@Inject(method = "next", at = @At("HEAD"), cancellable = true)
|
||||
private void unwrapGameModes(CallbackInfoReturnable<Optional<GameModeSelectionScreen.GameModeSelection>> cir) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThan(VersionEnum.r1_8)) {
|
||||
private void unwrapGameModes(CallbackInfoReturnable<GameModeSelectionScreen.GameModeSelection> cir) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_7_6tor1_7_10)) {
|
||||
switch ((GameModeSelectionScreen.GameModeSelection) (Object) this) {
|
||||
case CREATIVE -> cir.setReturnValue(Optional.of(SURVIVAL));
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user