From 71cc1ca4b5cd94e08c90aff9a5ed1708b0688643 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Mon, 11 Oct 2021 11:05:50 +0200 Subject: [PATCH] Ignore invalid enchantment tags Fixes ViaVersion/ViaVersion#2693 --- .../viabackwards/api/rewriters/EnchantmentRewriter.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/com/viaversion/viabackwards/api/rewriters/EnchantmentRewriter.java b/common/src/main/java/com/viaversion/viabackwards/api/rewriters/EnchantmentRewriter.java index e1b2e8b2..20591217 100644 --- a/common/src/main/java/com/viaversion/viabackwards/api/rewriters/EnchantmentRewriter.java +++ b/common/src/main/java/com/viaversion/viabackwards/api/rewriters/EnchantmentRewriter.java @@ -87,10 +87,10 @@ public class EnchantmentRewriter { Iterator iterator = enchantments.iterator(); while (iterator.hasNext()) { CompoundTag enchantmentEntry = (CompoundTag) iterator.next(); - StringTag idTag = enchantmentEntry.get("id"); - if (idTag == null) continue; + Tag idTag = enchantmentEntry.get("id"); + if (!(idTag instanceof StringTag)) continue; - String enchantmentId = idTag.getValue(); + String enchantmentId = ((StringTag) idTag).getValue(); String remappedName = enchantmentMappings.get(enchantmentId); if (remappedName != null) { if (!changed) {