Correct tag name for writing and add compatibilty for created corrupt schematics

This commit is contained in:
dordsor21 2020-09-18 18:31:42 +01:00
parent 9c34702a47
commit cf750ba00c
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B
2 changed files with 6 additions and 2 deletions

View File

@ -157,6 +157,10 @@ public class FastSchematicReader extends NBTSchematicReader {
tilesDelegate.withInfo((length, type) -> tiles = new ArrayList<>(length));
tilesDelegate.withElem((ValueReader<Map<String, Object>>) (index, tile) -> tiles.add(tile));
StreamDelegate compatTilesDelegate = schematic.add("TileEntities");
compatTilesDelegate.withInfo((length, type) -> tiles = new ArrayList<>(length));
compatTilesDelegate.withElem((ValueReader<Map<String, Object>>) (index, tile) -> tiles.add(tile));
StreamDelegate entitiesDelegate = schematic.add("Entities");
entitiesDelegate.withInfo((length, type) -> entities = new ArrayList<>(length));
entitiesDelegate.withElem((ValueReader<Map<String, Object>>) (index, entity) -> entities.add(entity));

View File

@ -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()) {