mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-09-16 02:46:27 +02:00
Cleaned code.
This commit is contained in:
parent
ebf1075155
commit
5725345aef
@ -47,15 +47,13 @@ public class MixinGameModeSelectionScreen extends Screen {
|
|||||||
|
|
||||||
@Inject(method = "<init>", at = @At("RETURN"))
|
@Inject(method = "<init>", at = @At("RETURN"))
|
||||||
public void fixUIWidth(CallbackInfo ci) {
|
public 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());
|
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.SPECTATOR);
|
||||||
|
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_2_4tor1_2_5)) {
|
||||||
gameModeSelections.remove(GameModeSelectionScreen.GameModeSelection.ADVENTURE);
|
gameModeSelections.remove(GameModeSelectionScreen.GameModeSelection.ADVENTURE);
|
||||||
}
|
}
|
||||||
if (ProtocolHack.getTargetVersion().isOlderThan(VersionEnum.r1_8)) {
|
|
||||||
gameModeSelections.remove(GameModeSelectionScreen.GameModeSelection.SPECTATOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
viafabricplus_unwrappedGameModes = gameModeSelections.toArray(GameModeSelectionScreen.GameModeSelection[]::new);
|
viafabricplus_unwrappedGameModes = gameModeSelections.toArray(GameModeSelectionScreen.GameModeSelection[]::new);
|
||||||
UI_WIDTH = viafabricplus_unwrappedGameModes.length * 31 - 5;
|
UI_WIDTH = viafabricplus_unwrappedGameModes.length * 31 - 5;
|
||||||
@ -71,7 +69,7 @@ public 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;"))
|
@Redirect(method = "init", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screen/GameModeSelectionScreen$GameModeSelection;VALUES:[Lnet/minecraft/client/gui/screen/GameModeSelectionScreen$GameModeSelection;"))
|
||||||
public GameModeSelectionScreen.GameModeSelection[] removeNewerGameModes() {
|
public GameModeSelectionScreen.GameModeSelection[] removeNewerGameModes() {
|
||||||
if (ProtocolHack.getTargetVersion().isOlderThan(VersionEnum.r1_8)) {
|
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_7_6tor1_7_10)) {
|
||||||
return viafabricplus_unwrappedGameModes;
|
return viafabricplus_unwrappedGameModes;
|
||||||
}
|
}
|
||||||
return GameModeSelectionScreen.GameModeSelection.values();
|
return GameModeSelectionScreen.GameModeSelection.values();
|
||||||
|
@ -53,7 +53,7 @@ public class MixinGameModeSelectionScreen_GameModeSelection {
|
|||||||
|
|
||||||
@Inject(method = "next", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "next", at = @At("HEAD"), cancellable = true)
|
||||||
private void unwrapGameModes(CallbackInfoReturnable<GameModeSelectionScreen.GameModeSelection> cir) {
|
private void unwrapGameModes(CallbackInfoReturnable<GameModeSelectionScreen.GameModeSelection> cir) {
|
||||||
if (ProtocolHack.getTargetVersion().isOlderThan(VersionEnum.r1_8)) {
|
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_7_6tor1_7_10)) {
|
||||||
switch ((GameModeSelectionScreen.GameModeSelection) (Object) this) {
|
switch ((GameModeSelectionScreen.GameModeSelection) (Object) this) {
|
||||||
case CREATIVE -> cir.setReturnValue(SURVIVAL);
|
case CREATIVE -> cir.setReturnValue(SURVIVAL);
|
||||||
case SURVIVAL -> {
|
case SURVIVAL -> {
|
||||||
|
Loading…
Reference in New Issue
Block a user