From 7e773c99706c8f216ab1d19a0c5e00d181f8c4ba Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 2 Mar 2021 19:10:17 -0500 Subject: [PATCH] Quietly handle unmappable Java items If vanilla can handle them, so can we. --- .../connector/network/translators/item/ItemTranslator.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java index f63df2f7e..60aa0b52c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java @@ -125,8 +125,12 @@ public abstract class ItemTranslator { } ItemEntry bedrockItem = ItemRegistry.getItem(stack); + if (bedrockItem == null) { + session.getConnector().getLogger().debug("No matching ItemEntry for " + stack); + return ItemData.AIR; + } - com.github.steveice10.opennbt.tag.builtin.CompoundTag nbt = stack.getNbt() != null ? stack.getNbt().clone() : null; + CompoundTag nbt = stack.getNbt() != null ? stack.getNbt().clone() : null; // This is a fallback for maps with no nbt if (nbt == null && bedrockItem.getJavaIdentifier().equals("minecraft:filled_map")) {