From 9ca02680c8779ab1ef0b66969ba32206d6821f86 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Sun, 17 Mar 2024 10:47:12 +0100 Subject: [PATCH] Fix enchantment level --- .../rewriter/StructuredDataConverter.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_5to1_20_3/rewriter/StructuredDataConverter.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_5to1_20_3/rewriter/StructuredDataConverter.java index 6148e0f69..5f22409fe 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_5to1_20_3/rewriter/StructuredDataConverter.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_5to1_20_3/rewriter/StructuredDataConverter.java @@ -74,6 +74,9 @@ final class StructuredDataConverter { private static final Map, DataConverter> REWRITERS = new Reference2ObjectOpenHashMap<>(); static { + register(StructuredDataKey.CUSTOM_DATA, (data, tag) -> { + // Handled manually + }); register(StructuredDataKey.DAMAGE, (data, tag) -> tag.putInt("Damage", data)); register(StructuredDataKey.UNBREAKABLE, (data, tag) -> { tag.putBoolean("Unbreakable", true); @@ -524,7 +527,7 @@ final class StructuredDataConverter { final CompoundTag enchantment = new CompoundTag(); enchantment.putString("id", identifier); - enchantment.putShort("lvl", (short) entry.getIntKey()); + enchantment.putShort("lvl", (short) entry.getIntValue()); enchantments.add(enchantment); } tag.put(storedEnchantments ? "StoredEnchantments" : "Enchantments", enchantments);