mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2024-12-22 16:57:40 +01:00
Fix NPE
This commit is contained in:
parent
15348f659a
commit
5c1c7940a3
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user