3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-11-20 06:50:10 +01:00

Add sanity check in 1.13->1.12 enchantment handler

Closes #2908
Dieser Commit ist enthalten in:
Nassim Jahnke 2022-06-03 18:19:54 +02:00
Ursprung c2ae3df1db
Commit 9da206e280
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B

Datei anzeigen

@ -653,10 +653,17 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit
for (Tag enchantmentEntryTag : enchantments.clone()) { for (Tag enchantmentEntryTag : enchantments.clone()) {
CompoundTag enchantmentEntry = (CompoundTag) enchantmentEntryTag; CompoundTag enchantmentEntry = (CompoundTag) enchantmentEntryTag;
Tag idTag = enchantmentEntry.get("id"); Tag idTag = enchantmentEntry.get("id");
if (!(idTag instanceof StringTag)) continue; if (!(idTag instanceof StringTag)) {
continue;
}
String newId = (String) idTag.getValue(); String newId = (String) idTag.getValue();
int levelValue = ((NumberTag) enchantmentEntry.get("lvl")).asInt(); NumberTag levelTag = enchantmentEntry.get("lvl");
if (levelTag == null) {
continue;
}
int levelValue = levelTag.asInt();
short level = levelValue < Short.MAX_VALUE ? (short) levelValue : Short.MAX_VALUE; short level = levelValue < Short.MAX_VALUE ? (short) levelValue : Short.MAX_VALUE;
String mappedEnchantmentId = enchantmentMappings.get(newId); String mappedEnchantmentId = enchantmentMappings.get(newId);