This commit is contained in:
KennyTV 2021-02-17 12:24:20 +01:00
parent 15348f659a
commit 5c1c7940a3
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B

View File

@ -641,7 +641,10 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
boolean hasValidEnchants = false; boolean hasValidEnchants = false;
for (Tag enchantmentEntryTag : enchantments.clone()) { for (Tag enchantmentEntryTag : enchantments.clone()) {
CompoundTag enchantmentEntry = (CompoundTag) enchantmentEntryTag; CompoundTag enchantmentEntry = (CompoundTag) enchantmentEntryTag;
String newId = (String) enchantmentEntry.get("id").getValue(); Tag idTag = enchantmentEntry.get("id");
if (!(idTag instanceof StringTag)) continue;
String newId = (String) idTag.getValue();
Number levelValue = (Number) enchantmentEntry.get("lvl").getValue(); Number levelValue = (Number) enchantmentEntry.get("lvl").getValue();
int intValue = levelValue.intValue(); int intValue = levelValue.intValue();
short level = intValue < Short.MAX_VALUE ? levelValue.shortValue() : Short.MAX_VALUE; short level = intValue < Short.MAX_VALUE ? levelValue.shortValue() : Short.MAX_VALUE;