Merge pull request #673 from mikeprimm/addblock_bugfix
Fix problems with handling of schematic loads with extended block IDs
This commit is contained in:
commit
371f61c36b
@ -33,9 +33,15 @@ public class SchematicStreamer extends NBTStreamer {
|
||||
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.Data.?", initializer);
|
||||
addReader("Schematic.AddBlocks.?", initializer);
|
||||
addReader("Schematic.AddBlocks.?", initializer2);
|
||||
addReader("Schematic.Blocks.#", new ByteReader() {
|
||||
@Override
|
||||
public void run(int index, int value) {
|
||||
|
@ -238,6 +238,8 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
|
||||
area = width * length;
|
||||
volume = width * length * height;
|
||||
long size = width * height * length * 2l + HEADER_SIZE + (hasBiomes() ? area : 0);
|
||||
close();
|
||||
this.braf = new RandomAccessFile(file, "rw");
|
||||
braf.setLength(size);
|
||||
init();
|
||||
mbb.putChar(2, (char) width);
|
||||
@ -519,9 +521,8 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
|
||||
int index = (HEADER_SIZE) + (i << 1);
|
||||
// 00000000 00000000
|
||||
// [ id ]data
|
||||
byte id2 = mbb.get(index + 1);
|
||||
mbb.put(index, (byte) (id >> 4));
|
||||
mbb.put(index + 1, (byte) (((id & 0xFF) << 4) + (id2 & 0xFF)));
|
||||
char combined = mbb.getChar(index);
|
||||
mbb.putChar(index, (char) ((combined & 0xF00F) + (id << 4)));
|
||||
}
|
||||
|
||||
public void setCombined(int i, int combined) {
|
||||
@ -534,7 +535,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
|
||||
// 00000000 00000000
|
||||
// [ id ]data
|
||||
char combined = mbb.getChar(index);
|
||||
mbb.putChar(index, (char) ((combined & 0xFFFF) + (add << 12)));
|
||||
mbb.putChar(index, (char) ((combined & 0x0FFF) + (add << 12)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user