From cf750ba00c81015f2563c1d4a8f6a1e991dfc7c6 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Fri, 18 Sep 2020 18:31:42 +0100 Subject: [PATCH] Correct tag name for writing and add compatibilty for created corrupt schematics --- .../worldedit/extent/clipboard/io/FastSchematicReader.java | 4 ++++ .../worldedit/extent/clipboard/io/FastSchematicWriter.java | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/FastSchematicReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/FastSchematicReader.java index 76b6fc43f..74fb95955 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/FastSchematicReader.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/FastSchematicReader.java @@ -157,6 +157,10 @@ public class FastSchematicReader extends NBTSchematicReader { tilesDelegate.withInfo((length, type) -> tiles = new ArrayList<>(length)); tilesDelegate.withElem((ValueReader>) (index, tile) -> tiles.add(tile)); + StreamDelegate compatTilesDelegate = schematic.add("TileEntities"); + compatTilesDelegate.withInfo((length, type) -> tiles = new ArrayList<>(length)); + compatTilesDelegate.withElem((ValueReader>) (index, tile) -> tiles.add(tile)); + StreamDelegate entitiesDelegate = schematic.add("Entities"); entitiesDelegate.withInfo((length, type) -> entities = new ArrayList<>(length)); entitiesDelegate.withElem((ValueReader>) (index, entity) -> entities.add(entity)); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/FastSchematicWriter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/FastSchematicWriter.java index 2178483c9..a13667eb8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/FastSchematicWriter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/FastSchematicWriter.java @@ -210,14 +210,14 @@ public class FastSchematicWriter implements ClipboardWriter { } if (numTiles != 0) { - out.writeNamedTagName("TileEntities", NBTConstants.TYPE_LIST); + out.writeNamedTagName("BlockEntities", NBTConstants.TYPE_LIST); rawStream.write(NBTConstants.TYPE_COMPOUND); rawStream.writeInt(numTiles); try (LZ4BlockInputStream in = new LZ4BlockInputStream(new ByteArrayInputStream(tilesCompressed.toByteArray()))) { IOUtil.copy(in, rawStream); } } else { - out.writeNamedEmptyList("TileEntities"); + out.writeNamedEmptyList("BlockEntities"); } if (finalClipboard.hasBiomes()) {