Fix enchantment conversion (#920)

* Fix java to bedrock enchantments

* Fix NBT conversion and add Soul Speed enchantment

* Remove unused import
This commit is contained in:
rtm516 2020-07-14 08:18:11 +01:00 committed by GitHub
parent 23f33881cd
commit 04e73efd94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 7 deletions

View file

@ -66,7 +66,8 @@ public enum Enchantment {
CHANNELING, CHANNELING,
MULTISHOT, MULTISHOT,
PIERCING, PIERCING,
QUICK_CHARGE; QUICK_CHARGE,
SOUL_SPEED;
private final String javaIdentifier; private final String javaIdentifier;

View file

@ -304,7 +304,7 @@ public abstract class ItemTranslator {
if (tag != null && !tag.isEmpty()) { if (tag != null && !tag.isEmpty()) {
for (String str : tag.keySet()) { for (String str : tag.keySet()) {
Object bedrockTag = tag.get(str); 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) if (translatedTag == null)
continue; continue;
@ -370,11 +370,7 @@ public abstract class ItemTranslator {
if (object instanceof NbtMap) { if (object instanceof NbtMap) {
NbtMap map = (NbtMap) object; NbtMap map = (NbtMap) object;
for (Map.Entry<String, Object> entry : map.entrySet()) { return translateToJavaNBT(name, map);
if (entry.getValue().equals(map.get(name))) {
return translateToJavaNBT(entry.getKey(), map.getCompound(name));
}
}
} }
return null; return null;