Add sanity check to enchantment nbt check

This commit is contained in:
KennyTV 2021-01-08 09:05:57 +01:00
parent 1c4b27e56c
commit 4a360bac44
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B

View File

@ -63,7 +63,10 @@ public class EnchantmentRewriter {
ListTag remappedEnchantments = new ListTag(nbtTagName + "|" + key, CompoundTag.class);
List<Tag> lore = new ArrayList<>();
for (Tag enchantmentEntry : enchantments.clone()) {
String newId = (String) ((CompoundTag) enchantmentEntry).get("id").getValue();
Tag idTag = ((CompoundTag) enchantmentEntry).get("id");
if (idTag == null) continue;
String newId = (String) idTag.getValue();
String enchantmentName = enchantmentMappings.get(newId);
if (enchantmentName != null) {
enchantments.remove(enchantmentEntry);