From 28ce2ebc323838f60859834fa539780d7b19b0ed Mon Sep 17 00:00:00 2001 From: FlorianMichael <60033407+FlorianMichael@users.noreply.github.com> Date: Wed, 5 Apr 2023 18:47:42 +0200 Subject: [PATCH] Updated Via* --- README.md | 2 +- gradle.properties | 4 ++-- .../injection/mixin/bridge/MixinAddServerScreen.java | 2 +- .../injection/mixin/bridge/MixinServerInfo.java | 6 +++++- .../mixin/fixes/viaversion/MixinProtocolVersion.java | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3df910f8..efd60648 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ It should work fine with most if not all mods and modpacks. - ***[Krypton](https://github.com/astei/krypton)*** ## Supported Server versions -- Release (1.0.0 - 1.20 [23w13a]) +- Release (1.0.0 - 1.20 [23w14a]) - Beta (b1.0 - b1.8.1) - Alpha (a1.0.15 - a1.2.6) - Classic (c0.0.15 - c0.30 including [CPE](https://wiki.vg/Classic_Protocol_Extension)) diff --git a/gradle.properties b/gradle.properties index e328e487..52070ba0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,8 +18,8 @@ vialoadingbase_version=ae89fec4ab raknet_transport_version=1.0.0.CR1-SNAPSHOT # viaversion (and required) libs -viaversion_version=4.7.0-23w13a-SNAPSHOT -viabackwards_version=4.7.0-23w13a-SNAPSHOT +viaversion_version=4.7.0-23w14a-SNAPSHOT +viabackwards_version=4.7.0-23w14a-SNAPSHOT snake_yml_version=2.0 # raphimc libs diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/bridge/MixinAddServerScreen.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/bridge/MixinAddServerScreen.java index 19729612..9afb117c 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/bridge/MixinAddServerScreen.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/bridge/MixinAddServerScreen.java @@ -44,7 +44,7 @@ public class MixinAddServerScreen extends Screen { @Inject(method = "init", at = @At("RETURN")) public void injectButton(CallbackInfo ci) { final ComparableProtocolVersion forcedVersion = ((IServerInfo) server).viafabricplus_forcedVersion(); - this.addDrawableChild(ButtonWidget.builder(Text.literal(forcedVersion == null ? "Set version for this server" :forcedVersion.getName()), button -> + this.addDrawableChild(ButtonWidget.builder(Text.literal(forcedVersion == null ? "Set version for this server" : forcedVersion.getName()), button -> client.setScreen(new ForceVersionScreen(this, version -> ((IServerInfo) server).viafabricplus_forceVersion(version)))). position(width - (forcedVersion == null ? 150 : 98) - 5, 5).size(forcedVersion == null ? 150 : 98, 20).build()); } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/bridge/MixinServerInfo.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/bridge/MixinServerInfo.java index c6afd446..52801ecd 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/bridge/MixinServerInfo.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/bridge/MixinServerInfo.java @@ -59,7 +59,11 @@ public class MixinServerInfo implements IServerInfo { @Inject(method = "fromNbt", at = @At("TAIL"), locals = LocalCapture.CAPTURE_FAILHARD) private static void loadForcedVersion(NbtCompound root, CallbackInfoReturnable cir, ServerInfo serverInfo) { if (root.contains("viafabricplus_forcedversion")) { - ((IServerInfo) serverInfo).viafabricplus_forceVersion(ViaLoadingBase.fromProtocolId(root.getInt("viafabricplus_forcedversion"))); + try { + ((IServerInfo) serverInfo).viafabricplus_forceVersion(ViaLoadingBase.fromProtocolId(root.getInt("viafabricplus_forcedversion"))); + } catch (Exception ignored) { + // Version doesn't exist anymore + } } } diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinProtocolVersion.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinProtocolVersion.java index 77574346..92b21e12 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinProtocolVersion.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinProtocolVersion.java @@ -45,7 +45,7 @@ public abstract class MixinProtocolVersion { viafabricplus_remaps.put("1.16.4/5", new Pair<>("1.16.4-1.16.5", null)); viafabricplus_remaps.put("1.18/1.18.1", new Pair<>("1.18-1.18.1", null)); viafabricplus_remaps.put("1.19.1/2", new Pair<>("1.19.1-1.19.2", null)); - viafabricplus_remaps.put("1.20", new Pair<>("23w13a", null)); + viafabricplus_remaps.put("1.20", new Pair<>("23w14a", null)); } @Redirect(method = "", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/api/protocol/version/ProtocolVersion;register(ILjava/lang/String;)Lcom/viaversion/viaversion/api/protocol/version/ProtocolVersion;"))