This commit is contained in:
Jesse Boyd 2017-09-07 18:39:26 +10:00
parent 398943b9b0
commit 477ae2a76d
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 23 additions and 15 deletions

View File

@ -72,6 +72,14 @@ public class SchematicStreamer extends NBTStreamer {
fc.setBiome(index, value);
}
};
NBTStreamReader<Integer, Integer> initializer23 = new NBTStreamReader<Integer, Integer>() {
@Override
public void run(Integer value1, Integer value2) {
if (fc == null) setupClipboard(length * width * height);
}
};
addReader("Schematic.AWEBiomes.?", initializer23);
addReader("Schematic.Biomes.?", initializer23);
addReader("Schematic.AWEBiomes.#", biomeReader); // AWE stores as an int[]
addReader("Schematic.Biomes.#", biomeReader); // FAWE stores as a byte[] (4x smaller)

View File

@ -155,21 +155,6 @@ public class SchematicWriter implements ClipboardWriter {
out.writeNamedTag("WEOffsetZ", (offset.getBlockZ()));
out.writeNamedTag("Platform", Fawe.imp().getPlatform());
if (clipboard.IMP.hasBiomes()) {
out.writeNamedTagName("Biomes", NBTConstants.TYPE_BYTE_ARRAY);
out.getOutputStream().writeInt(width * length); // area
clipboard.IMP.streamBiomes(new NBTStreamer.ByteReader() {
@Override
public void run(int index, int byteValue) {
try {
rawStream.writeByte(byteValue);
} catch (IOException e) {
e.printStackTrace();
}
}
});
}
out.writeNamedTagName("Blocks", NBTConstants.TYPE_BYTE_ARRAY);
out.getOutputStream().writeInt(volume);
clipboard.IMP.streamIds(new NBTStreamer.ByteReader() {
@ -239,6 +224,21 @@ public class SchematicWriter implements ClipboardWriter {
}
}
if (clipboard.IMP.hasBiomes()) {
out.writeNamedTagName("Biomes", NBTConstants.TYPE_BYTE_ARRAY);
out.getOutputStream().writeInt(width * length); // area
clipboard.IMP.streamBiomes(new NBTStreamer.ByteReader() {
@Override
public void run(int index, int byteValue) {
try {
rawStream.writeByte(byteValue);
} catch (IOException e) {
e.printStackTrace();
}
}
});
}
if (hasTile) {
final List<CompoundTag> tileEntities = clipboard.IMP.getTileEntities();
out.writeNamedTag("TileEntities", new ListTag(CompoundTag.class, tileEntities));