From c45597c8850918e9d1c3d58da19833e9d6d9b209 Mon Sep 17 00:00:00 2001 From: Corey Shupe Date: Tue, 7 Jun 2022 23:23:50 -0400 Subject: [PATCH] Hotfix registry and argument ser/de (#729) * Hotfix argument parser missing * Fix join game registry announcing. --- .../proxy/protocol/packet/JoinGame.java | 14 ++++++++++---- .../packet/brigadier/ArgumentPropertyRegistry.java | 6 +++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/JoinGame.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/JoinGame.java index da86363b7..aba321564 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/JoinGame.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/JoinGame.java @@ -273,7 +273,11 @@ public class JoinGame implements MinecraftPacket { dimensionRegistryContainer = registryContainer.getCompound("minecraft:dimension_type") .getList("value", BinaryTagTypes.COMPOUND); this.biomeRegistry = registryContainer.getCompound("minecraft:worldgen/biome"); - this.chatTypeRegistry = registryContainer.getCompound("minecraft:chat_type"); + if (version.compareTo(ProtocolVersion.MINECRAFT_1_19) >= 0) { + this.chatTypeRegistry = registryContainer.getCompound("minecraft:chat_type"); + } else { + this.chatTypeRegistry = CompoundBinaryTag.empty(); + } } else { dimensionRegistryContainer = registryContainer.getList("dimension", BinaryTagTypes.COMPOUND); @@ -285,7 +289,7 @@ public class JoinGame implements MinecraftPacket { String dimensionIdentifier; String levelName = null; if (version.compareTo(ProtocolVersion.MINECRAFT_1_16_2) >= 0 - && version.compareTo(ProtocolVersion.MINECRAFT_1_19) < 0) { + && version.compareTo(ProtocolVersion.MINECRAFT_1_19) < 0) { CompoundBinaryTag currentDimDataTag = ProtocolUtils.readCompoundTag(buf, JOINGAME_READER); dimensionIdentifier = ProtocolUtils.readString(buf); this.currentDimensionData = DimensionData.decodeBaseCompoundTag(currentDimDataTag, version) @@ -382,13 +386,15 @@ public class JoinGame implements MinecraftPacket { dimensionRegistryEntry.put("value", encodedDimensionRegistry); registryContainer.put("minecraft:dimension_type", dimensionRegistryEntry.build()); registryContainer.put("minecraft:worldgen/biome", biomeRegistry); - registryContainer.put("minecraft:chat_type", chatTypeRegistry); + if (version.compareTo(ProtocolVersion.MINECRAFT_1_19) >= 0) { + registryContainer.put("minecraft:chat_type", chatTypeRegistry); + } } else { registryContainer.put("dimension", encodedDimensionRegistry); } ProtocolUtils.writeCompoundTag(buf, registryContainer.build()); if (version.compareTo(ProtocolVersion.MINECRAFT_1_16_2) >= 0 - && version.compareTo(ProtocolVersion.MINECRAFT_1_19) < 0) { + && version.compareTo(ProtocolVersion.MINECRAFT_1_19) < 0) { ProtocolUtils.writeCompoundTag(buf, currentDimensionData.serializeDimensionDetails()); ProtocolUtils.writeString(buf, dimensionInfo.getRegistryIdentifier()); } else { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ArgumentPropertyRegistry.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ArgumentPropertyRegistry.java index ddd59c78e..bdadb9573 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ArgumentPropertyRegistry.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ArgumentPropertyRegistry.java @@ -229,7 +229,11 @@ public class ArgumentPropertyRegistry { register(id("minecraft:resource", mapSet(MINECRAFT_1_19, 44)), RegistryKeyArgument.class, RegistryKeyArgumentSerializer.REGISTRY); - empty(id("minecraft:uuid", mapSet(MINECRAFT_1_19, 45))); // added in 1.16 + empty(id("minecraft:template_mirror", mapSet(MINECRAFT_1_19, 45))); // 1.19 + empty(id("minecraft:template_rotation", mapSet(MINECRAFT_1_19, 46))); // 1.19 + + empty(id("minecraft:uuid", mapSet(MINECRAFT_1_19, 47))); // added in 1.16 + // Crossstitch support register(id("crossstitch:mod_argument", mapSet(MINECRAFT_1_19, -256)), ModArgumentProperty.class, MOD);