Don't save corrupt schematics so that when they load, they work.

This commit is contained in:
dordsor21 2020-12-13 21:09:05 +00:00
parent c85ff7ddda
commit 6d71177394
No known key found for this signature in database
GPG key ID: 1E53E88969FFCF0B

View file

@ -537,7 +537,7 @@ public abstract class SchematicHandler {
schematic.put("Palette", new CompoundTag(paletteTag)); schematic.put("Palette", new CompoundTag(paletteTag));
schematic.put("BlockData", new ByteArrayTag(buffer.toByteArray())); schematic.put("BlockData", new ByteArrayTag(buffer.toByteArray()));
schematic schematic
.put("TileEntities", new ListTag(CompoundTag.class, tileEntities)); .put("BlockEntities", new ListTag(CompoundTag.class, tileEntities));
schematic.put("BiomePaletteMax", new IntTag(biomePalette.size())); schematic.put("BiomePaletteMax", new IntTag(biomePalette.size()));
@ -602,8 +602,6 @@ public abstract class SchematicHandler {
values.put(entry.getKey(), values.put(entry.getKey(),
entry.getValue()); entry.getValue());
} }
// Remove 'id' if it exists. We want 'Id'
values.remove("id");
// Positions are kept in NBT, we don't want that. // Positions are kept in NBT, we don't want that.
values.remove("x"); values.remove("x");
@ -612,6 +610,11 @@ public abstract class SchematicHandler {
values.put("Id", values.put("Id",
new StringTag(block.getNbtId())); 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( values.put("Pos", new IntArrayTag(
new int[] {rx, ry, rz})); new int[] {rx, ry, rz}));