From 7e47490e7053d110a33a3c86b025af91bd803388 Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 1 Mar 2022 02:00:00 +1100 Subject: [PATCH] Minecraft 1.18.2 support --- .../md_5/bungee/protocol/ProtocolConstants.java | 4 +++- .../md_5/bungee/protocol/packet/Commands.java | 16 ++++++++++++++++ .../net/md_5/bungee/entitymap/EntityMap.java | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/ProtocolConstants.java b/protocol/src/main/java/net/md_5/bungee/protocol/ProtocolConstants.java index a821fb545d..7da127fb33 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/ProtocolConstants.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/ProtocolConstants.java @@ -37,6 +37,7 @@ public class ProtocolConstants public static final int MINECRAFT_1_17 = 755; public static final int MINECRAFT_1_17_1 = 756; public static final int MINECRAFT_1_18 = 757; + public static final int MINECRAFT_1_18_2 = 758; public static final List SUPPORTED_VERSIONS; public static final List SUPPORTED_VERSION_IDS; @@ -85,7 +86,8 @@ public class ProtocolConstants ProtocolConstants.MINECRAFT_1_16_4, ProtocolConstants.MINECRAFT_1_17, ProtocolConstants.MINECRAFT_1_17_1, - ProtocolConstants.MINECRAFT_1_18 + ProtocolConstants.MINECRAFT_1_18, + ProtocolConstants.MINECRAFT_1_18_2 ); if ( SNAPSHOT_SUPPORT ) diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/Commands.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Commands.java index 26edbca85b..633e557cd3 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/Commands.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Commands.java @@ -498,6 +498,20 @@ protected String getKey() return "brigadier:string"; } }; + private static final ArgumentSerializer RAW_STRING = new ArgumentSerializer() + { + @Override + protected String read(ByteBuf buf) + { + return DefinedPacket.readString( buf ); + } + + @Override + protected void write(ByteBuf buf, String t) + { + DefinedPacket.writeString( t, buf ); + } + }; static { @@ -551,6 +565,8 @@ protected String getKey() PROVIDERS.put( "minecraft:test_argument", VOID ); // 1.16, debug PROVIDERS.put( "minecraft:test_class", VOID ); // 1.16, debug PROVIDERS.put( "minecraft:angle", VOID ); // 1.16.2 + PROVIDERS.put( "minecraft:resource", RAW_STRING ); // 1.18.2 + PROVIDERS.put( "minecraft:resource_or_tag", RAW_STRING ); // 1.18.2 } private static ArgumentType read(String key, ByteBuf buf) diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java index 23715f68c8..75164c67f3 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java @@ -72,6 +72,7 @@ public static EntityMap getEntityMap(int version) case ProtocolConstants.MINECRAFT_1_17_1: return EntityMap_1_16_2.INSTANCE_1_17; case ProtocolConstants.MINECRAFT_1_18: + case ProtocolConstants.MINECRAFT_1_18_2: return EntityMap_1_16_2.INSTANCE_1_18; } throw new RuntimeException( "Version " + version + " has no entity map" );