From 6d7117739441921d8fb08920428fe594ba951455 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sun, 13 Dec 2020 21:09:05 +0000 Subject: [PATCH] Don't save corrupt schematics so that when they load, they work. --- .../java/com/plotsquared/core/util/SchematicHandler.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java b/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java index 92b1b2ef4..987aa3fff 100644 --- a/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java +++ b/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java @@ -537,7 +537,7 @@ public abstract class SchematicHandler { schematic.put("Palette", new CompoundTag(paletteTag)); schematic.put("BlockData", new ByteArrayTag(buffer.toByteArray())); schematic - .put("TileEntities", new ListTag(CompoundTag.class, tileEntities)); + .put("BlockEntities", new ListTag(CompoundTag.class, tileEntities)); schematic.put("BiomePaletteMax", new IntTag(biomePalette.size())); @@ -602,8 +602,6 @@ public abstract class SchematicHandler { values.put(entry.getKey(), entry.getValue()); } - // Remove 'id' if it exists. We want 'Id' - values.remove("id"); // Positions are kept in NBT, we don't want that. values.remove("x"); @@ -612,6 +610,11 @@ public abstract class SchematicHandler { values.put("Id", new StringTag(block.getNbtId())); + + // Remove 'id' if it exists. We want 'Id'. + // Do this after we get "getNbtId" cos otherwise "getNbtId" doesn't work. + // Dum. + values.remove("id"); values.put("Pos", new IntArrayTag( new int[] {rx, ry, rz}));