From aa216a990aa3a37d63f0b0c33607984de737ca60 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Mon, 29 Aug 2022 17:21:21 +0200 Subject: [PATCH] Update upstream 7e61ff1 Work around invalid legacy values in schematics (2171) --- .../extent/clipboard/io/MCEditSchematicReader.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java index 760598ad5..aebef3e9a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java @@ -484,7 +484,12 @@ public class MCEditSchematicReader extends NBTSchematicReader { } private BlockState getBlockState(int id, int data) { - return LegacyMapper.getInstance().getBlockFromLegacy(id, data); + BlockState foundBlock = LegacyMapper.getInstance().getBlockFromLegacy(id, data); + if (foundBlock == null && data != 0) { + // Some schematics contain invalid data values, so try without the data value + return LegacyMapper.getInstance().getBlockFromLegacy(id, 0); + } + return foundBlock; } @Override