From bd714b2f76d88999bd94f97bb10b985ba2e43862 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 1 May 2024 11:28:43 -0700 Subject: [PATCH] Fix MDK by bumping FG and disabling reobf tasks Fix LAN server IPs being duplicated Fix connecting to vanilla servers due to misapplied patch. --- mdk/build.gradle | 5 ++++- .../minecraft/client/server/LanServerDetection.java.patch | 5 +++-- .../network/syncher/EntityDataSerializers.java.patch | 6 ++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/mdk/build.gradle b/mdk/build.gradle index 4d92d9f01a..791f614f7d 100644 --- a/mdk/build.gradle +++ b/mdk/build.gradle @@ -2,7 +2,7 @@ plugins { id 'eclipse' id 'idea' id 'maven-publish' - id 'net.minecraftforge.gradle' version '[6.0.16,6.2)' + id 'net.minecraftforge.gradle' version '[6.0.24,6.2)' } version = mod_version @@ -31,6 +31,9 @@ minecraft { // Use non-default mappings at your own risk. They may not always work. // Simply re-run your setup task after changing the mappings to update your workspace. mappings channel: mapping_channel, version: mapping_version + + // Tell FG to not automtically create the reobf tasks, as we now use Official mappings at runtime, If you don't use them at dev time then you'll have to fix your reobf yourself. + reobf = false // When true, this property will have all Eclipse/IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game. // In most cases, it is not necessary to enable. diff --git a/patches/minecraft/net/minecraft/client/server/LanServerDetection.java.patch b/patches/minecraft/net/minecraft/client/server/LanServerDetection.java.patch index 37aa0993fb..9a4f399cef 100644 --- a/patches/minecraft/net/minecraft/client/server/LanServerDetection.java.patch +++ b/patches/minecraft/net/minecraft/client/server/LanServerDetection.java.patch @@ -9,10 +9,11 @@ this.socket.setSoTimeout(5000); this.socket.joinGroup(this.pingGroup); } -@@ -89,6 +_,11 @@ +@@ -88,7 +_,11 @@ + String s = LanServerPinger.parseMotd(p_120097_); String s1 = LanServerPinger.parseAddress(p_120097_); if (s1 != null) { - s1 = p_120098_.getHostAddress() + ":" + s1; +- s1 = p_120098_.getHostAddress() + ":" + s1; + if (net.minecraftforge.network.DualStackUtils.checkIPv6(p_120098_)) { + s1 = "[" + com.google.common.net.InetAddresses.toAddrString(p_120098_) + "]:" + s1; + } else { diff --git a/patches/minecraft/net/minecraft/network/syncher/EntityDataSerializers.java.patch b/patches/minecraft/net/minecraft/network/syncher/EntityDataSerializers.java.patch index 58a08ca5b6..278ca4ad8e 100644 --- a/patches/minecraft/net/minecraft/network/syncher/EntityDataSerializers.java.patch +++ b/patches/minecraft/net/minecraft/network/syncher/EntityDataSerializers.java.patch @@ -1,10 +1,12 @@ --- a/net/minecraft/network/syncher/EntityDataSerializers.java +++ b/net/minecraft/network/syncher/EntityDataSerializers.java -@@ -121,15 +_,16 @@ +@@ -120,16 +_,18 @@ + public static final EntityDataSerializer QUATERNION = EntityDataSerializer.forValueType(ByteBufCodecs.QUATERNIONF); public static void registerSerializer(EntityDataSerializer p_135051_) { ++ int id = SERIALIZERS.add(p_135051_); -+ if (SERIALIZERS.add(p_135051_) >= 256) throw new RuntimeException("Vanilla DataSerializer ID limit exceeded"); ++ if (id >= 256) throw new RuntimeException("Vanilla DataSerializer ID limit exceeded"); } @Nullable