3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-03 14:50:30 +01:00

Fix invalid enchantment parsing

Fixes #2418
Dieser Commit ist enthalten in:
KennyTV 2021-04-02 18:22:18 +02:00
Ursprung 070c7f5808
Commit 1251d43709
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B

Datei anzeigen

@ -329,9 +329,10 @@ public class InventoryPackets {
ListTag ench = tag.get("ench"); ListTag ench = tag.get("ench");
ListTag enchantments = new ListTag(CompoundTag.class); ListTag enchantments = new ListTag(CompoundTag.class);
for (Tag enchEntry : ench) { for (Tag enchEntry : ench) {
if (enchEntry instanceof CompoundTag) { NumberTag idTag;
if (enchEntry instanceof CompoundTag && (idTag = ((CompoundTag) enchEntry).get("id")) != null) {
CompoundTag enchantmentEntry = new CompoundTag(); CompoundTag enchantmentEntry = new CompoundTag();
short oldId = ((NumberTag) ((CompoundTag) enchEntry).get("id")).asShort(); short oldId = idTag.asShort();
String newId = Protocol1_13To1_12_2.MAPPINGS.getOldEnchantmentsIds().get(oldId); String newId = Protocol1_13To1_12_2.MAPPINGS.getOldEnchantmentsIds().get(oldId);
if (newId == null) { if (newId == null) {
newId = "viaversion:legacy/" + oldId; newId = "viaversion:legacy/" + oldId;