From 04e73efd94f7dc640ad18a46ffee239d94917aee Mon Sep 17 00:00:00 2001 From: rtm516 Date: Tue, 14 Jul 2020 08:18:11 +0100 Subject: [PATCH] Fix enchantment conversion (#920) * Fix java to bedrock enchantments * Fix NBT conversion and add Soul Speed enchantment * Remove unused import --- .../connector/network/translators/item/Enchantment.java | 3 ++- .../network/translators/item/ItemTranslator.java | 8 ++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/Enchantment.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/Enchantment.java index ebdfe6506..31ec0c7fb 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/Enchantment.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/Enchantment.java @@ -66,7 +66,8 @@ public enum Enchantment { CHANNELING, MULTISHOT, PIERCING, - QUICK_CHARGE; + QUICK_CHARGE, + SOUL_SPEED; private final String javaIdentifier; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java index 01107a3d0..27c6c2625 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java @@ -304,7 +304,7 @@ public abstract class ItemTranslator { if (tag != null && !tag.isEmpty()) { for (String str : tag.keySet()) { Object bedrockTag = tag.get(str); - com.github.steveice10.opennbt.tag.builtin.Tag translatedTag = translateToJavaNBT(name, bedrockTag); + com.github.steveice10.opennbt.tag.builtin.Tag translatedTag = translateToJavaNBT(str, bedrockTag); if (translatedTag == null) continue; @@ -370,11 +370,7 @@ public abstract class ItemTranslator { if (object instanceof NbtMap) { NbtMap map = (NbtMap) object; - for (Map.Entry entry : map.entrySet()) { - if (entry.getValue().equals(map.get(name))) { - return translateToJavaNBT(entry.getKey(), map.getCompound(name)); - } - } + return translateToJavaNBT(name, map); } return null;