mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-02 08:59:31 +01:00
Cleaned code.
This commit is contained in:
parent
ebf1075155
commit
5725345aef
@ -47,14 +47,12 @@ public class MixinGameModeSelectionScreen extends Screen {
|
||||
|
||||
@Inject(method = "<init>", at = @At("RETURN"))
|
||||
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());
|
||||
|
||||
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().isOlderThanOrEqualTo(VersionEnum.r1_2_4tor1_2_5)) {
|
||||
gameModeSelections.remove(GameModeSelectionScreen.GameModeSelection.ADVENTURE);
|
||||
}
|
||||
|
||||
viafabricplus_unwrappedGameModes = gameModeSelections.toArray(GameModeSelectionScreen.GameModeSelection[]::new);
|
||||
@ -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;"))
|
||||
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 GameModeSelectionScreen.GameModeSelection.values();
|
||||
|
@ -53,7 +53,7 @@ public class MixinGameModeSelectionScreen_GameModeSelection {
|
||||
|
||||
@Inject(method = "next", at = @At("HEAD"), cancellable = true)
|
||||
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) {
|
||||
case CREATIVE -> cir.setReturnValue(SURVIVAL);
|
||||
case SURVIVAL -> {
|
||||
|
Loading…
Reference in New Issue
Block a user