This commit is contained in:
Jesse Boyd 2017-03-29 06:59:23 +11:00
parent bb56a39792
commit ecbcc7e64b
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
3 changed files with 3 additions and 30 deletions

View File

@ -72,7 +72,7 @@ public class HistoryExtent extends AbstractDelegateExtent {
} }
try { try {
if (!FaweCache.hasNBT(id)) { if (!FaweCache.hasNBT(id)) {
if (FaweCache.hasNBT(block.getId())) { if (block.canStoreNBTData()) {
this.changeSet.add(x, y, z, combined, block); this.changeSet.add(x, y, z, combined, block);
} else { } else {
this.changeSet.add(x, y, z, combined, (block.getId() << 4) + block.getData()); this.changeSet.add(x, y, z, combined, (block.getId() << 4) + block.getData());

View File

@ -233,31 +233,6 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
public static long start; public static long start;
public static void main(String[] args) throws Throwable {
BaseBlock block = FaweCache.getBlock(0, 0);
DiskOptimizedClipboard clip = new DiskOptimizedClipboard(443, 256, 443, new File("test"));
start = System.currentTimeMillis();
clip.forEach(new BlockReader() {
@Override
public void run(int x, int y, int z, BaseBlock value2) {
}
}, true);
clip.close();
// BufferedRandomAccessFile raf = new BufferedRandomAccessFile(new File("test"), "rw");
// int len = 50000000;
// raf.setLength(len * 2);
// long start = System.currentTimeMillis();
// long total = 0;
// for (int i = 0; i < len; i++) {
// total += raf.readChar();
// }
// raf.close();
System.out.println(System.currentTimeMillis() - start + "ms");
// System.out.println("Total " + total);
System.exit(1);
}
@Override @Override
public void streamDatas(NBTStreamer.ByteReader task) { public void streamDatas(NBTStreamer.ByteReader task) {
try { try {
@ -324,7 +299,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
int combinedId = raf.readChar(); int combinedId = raf.readChar();
if (combinedId != 0) { if (combinedId != 0) {
BaseBlock block = FaweCache.CACHE_BLOCK[combinedId]; BaseBlock block = FaweCache.CACHE_BLOCK[combinedId];
if (FaweCache.hasNBT(block.getId())) { if (block.canStoreNBTData()) {
trio.set(x, y, z); trio.set(x, y, z);
CompoundTag nbt = nbtMap.get(trio); CompoundTag nbt = nbtMap.get(trio);
if (nbt != null) { if (nbt != null) {
@ -357,7 +332,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
last = i; last = i;
int combinedId = raf.readChar(); int combinedId = raf.readChar();
BaseBlock block = FaweCache.CACHE_BLOCK[combinedId]; BaseBlock block = FaweCache.CACHE_BLOCK[combinedId];
if (FaweCache.hasNBT(block.getId())) { if (block.canStoreNBTData()) {
CompoundTag nbt = nbtMap.get(new IntegerTrio(x, y, z)); CompoundTag nbt = nbtMap.get(new IntegerTrio(x, y, z));
if (nbt != null) { if (nbt != null) {
block = new BaseBlock(block.getId(), block.getData()); block = new BaseBlock(block.getId(), block.getData());

View File

@ -160,7 +160,6 @@ public class SchematicWriter implements ClipboardWriter {
public void run(int index, int byteValue) { public void run(int index, int byteValue) {
try { try {
if (byteValue >= 256) { if (byteValue >= 256) {
System.out.println("Add block");
hasAdd = true; hasAdd = true;
} }
if (FaweCache.hasData(byteValue)) { if (FaweCache.hasData(byteValue)) {
@ -202,7 +201,6 @@ public class SchematicWriter implements ClipboardWriter {
@Override @Override
public void run(int index, int byteValue) { public void run(int index, int byteValue) {
try { try {
System.out.println("Add " + (byteValue >> 8));
rawStream.writeByte(byteValue >> 8); rawStream.writeByte(byteValue >> 8);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();