From 99ac42c168ff7f825e9df5b1fe5482f8a8b0dee3 Mon Sep 17 00:00:00 2001 From: Thom Date: Mon, 29 Jul 2019 12:19:30 +0200 Subject: [PATCH] Issue with the CanDestroy taglist (#1411) * Fix for an issue with the CanDestroy tag The CanDestroy taglist didn't go to lowercase when a 1.13+ user plays on a server equal to 1.12.2 or lower causing the taglist to not work any longer for items written in caps, this while a 1.12.2 client can use the item with the in caps written CanDestroy taglist on the server * Added Locale.ROOT to the toLowerCase() * Added the same functionality to CanPlaceOn --- .../protocol1_13to1_12_2/packets/InventoryPackets.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/InventoryPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/InventoryPackets.java index b4c5f8198..c9aed32b9 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/InventoryPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/InventoryPackets.java @@ -27,6 +27,7 @@ import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.SpawnEggRewriter; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; +import java.util.Locale; public class InventoryPackets { private static String NBT_TAG_NAME; @@ -404,13 +405,13 @@ public class InventoryPackets { if (numberConverted != null) { oldId = numberConverted; } - String[] newValues = BlockIdData.blockIdMapping.get(oldId); + String[] newValues = BlockIdData.blockIdMapping.get(oldId.toLowerCase(Locale.ROOT)); if (newValues != null) { for (String newValue : newValues) { newCanPlaceOn.add(new StringTag("", newValue)); } } else { - newCanPlaceOn.add(new StringTag("", oldId)); + newCanPlaceOn.add(new StringTag("", oldId.toLowerCase(Locale.ROOT))); } } tag.put(newCanPlaceOn); @@ -426,13 +427,13 @@ public class InventoryPackets { if (numberConverted != null) { oldId = numberConverted; } - String[] newValues = BlockIdData.blockIdMapping.get(oldId); + String[] newValues = BlockIdData.blockIdMapping.get(oldId.toLowerCase(Locale.ROOT)); if (newValues != null) { for (String newValue : newValues) { newCanDestroy.add(new StringTag("", newValue)); } } else { - newCanDestroy.add(new StringTag("", oldId)); + newCanDestroy.add(new StringTag("", oldId.toLowerCase(Locale.ROOT))); } } tag.put(newCanDestroy);