mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 09:47:38 +00:00
Correct tag name for writing and add compatibilty for created corrupt schematics
This commit is contained in:
parent
9c34702a47
commit
cf750ba00c
@ -157,6 +157,10 @@ public class FastSchematicReader extends NBTSchematicReader {
|
|||||||
tilesDelegate.withInfo((length, type) -> tiles = new ArrayList<>(length));
|
tilesDelegate.withInfo((length, type) -> tiles = new ArrayList<>(length));
|
||||||
tilesDelegate.withElem((ValueReader<Map<String, Object>>) (index, tile) -> tiles.add(tile));
|
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");
|
StreamDelegate entitiesDelegate = schematic.add("Entities");
|
||||||
entitiesDelegate.withInfo((length, type) -> entities = new ArrayList<>(length));
|
entitiesDelegate.withInfo((length, type) -> entities = new ArrayList<>(length));
|
||||||
entitiesDelegate.withElem((ValueReader<Map<String, Object>>) (index, entity) -> entities.add(entity));
|
entitiesDelegate.withElem((ValueReader<Map<String, Object>>) (index, entity) -> entities.add(entity));
|
||||||
|
@ -210,14 +210,14 @@ public class FastSchematicWriter implements ClipboardWriter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (numTiles != 0) {
|
if (numTiles != 0) {
|
||||||
out.writeNamedTagName("TileEntities", NBTConstants.TYPE_LIST);
|
out.writeNamedTagName("BlockEntities", NBTConstants.TYPE_LIST);
|
||||||
rawStream.write(NBTConstants.TYPE_COMPOUND);
|
rawStream.write(NBTConstants.TYPE_COMPOUND);
|
||||||
rawStream.writeInt(numTiles);
|
rawStream.writeInt(numTiles);
|
||||||
try (LZ4BlockInputStream in = new LZ4BlockInputStream(new ByteArrayInputStream(tilesCompressed.toByteArray()))) {
|
try (LZ4BlockInputStream in = new LZ4BlockInputStream(new ByteArrayInputStream(tilesCompressed.toByteArray()))) {
|
||||||
IOUtil.copy(in, rawStream);
|
IOUtil.copy(in, rawStream);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
out.writeNamedEmptyList("TileEntities");
|
out.writeNamedEmptyList("BlockEntities");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (finalClipboard.hasBiomes()) {
|
if (finalClipboard.hasBiomes()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user