Handle int tag for enchantment level

This commit is contained in:
AJ Ferguson 2020-06-29 16:34:07 -08:00
parent 7710261b70
commit 95144266d2

View file

@ -122,7 +122,7 @@ public class EnchantmentTranslator extends NbtItemStackTranslator {
private CompoundTag remapEnchantment(CompoundTag tag) {
Tag javaEnchLvl = tag.get("lvl");
if (!(javaEnchLvl instanceof ShortTag))
if (!(javaEnchLvl instanceof ShortTag || javaEnchLvl instanceof IntTag))
return null;
Tag javaEnchId = tag.get("id");
@ -137,7 +137,7 @@ public class EnchantmentTranslator extends NbtItemStackTranslator {
CompoundTag bedrockTag = new CompoundTag("");
bedrockTag.put(new ShortTag("id", (short) enchantment.ordinal()));
bedrockTag.put(new ShortTag("lvl", ((ShortTag) javaEnchLvl).getValue()));
bedrockTag.put(new ShortTag("lvl", ((Number) javaEnchLvl.getValue()).shortValue()));
return bedrockTag;
}