Fix handling of AddBlocks length, DiskClipboard resize

This commit is contained in:
Mike Primm 2017-08-01 20:47:16 -05:00
parent 1cc9a37520
commit 8c519afce6
2 changed files with 9 additions and 1 deletions

View File

@ -33,9 +33,15 @@ public class SchematicStreamer extends NBTStreamer {
setupClipboard(length); setupClipboard(length);
} }
}; };
NBTStreamReader initializer2 = new NBTStreamReader<Integer, Integer>() {
@Override
public void run(Integer length, Integer type) {
setupClipboard(length*2);
}
};
addReader("Schematic.Blocks.?", initializer); addReader("Schematic.Blocks.?", initializer);
addReader("Schematic.Data.?", initializer); addReader("Schematic.Data.?", initializer);
addReader("Schematic.AddBlocks.?", initializer); addReader("Schematic.AddBlocks.?", initializer2);
addReader("Schematic.Blocks.#", new ByteReader() { addReader("Schematic.Blocks.#", new ByteReader() {
@Override @Override
public void run(int index, int value) { public void run(int index, int value) {

View File

@ -238,6 +238,8 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
area = width * length; area = width * length;
volume = width * length * height; volume = width * length * height;
long size = width * height * length * 2l + HEADER_SIZE + (hasBiomes() ? area : 0); long size = width * height * length * 2l + HEADER_SIZE + (hasBiomes() ? area : 0);
close();
this.braf = new RandomAccessFile(file, "rw");
braf.setLength(size); braf.setLength(size);
init(); init();
mbb.putChar(2, (char) width); mbb.putChar(2, (char) width);