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 {
if (!FaweCache.hasNBT(id)) {
if (FaweCache.hasNBT(block.getId())) {
if (block.canStoreNBTData()) {
this.changeSet.add(x, y, z, combined, block);
} else {
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 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
public void streamDatas(NBTStreamer.ByteReader task) {
try {
@ -324,7 +299,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
int combinedId = raf.readChar();
if (combinedId != 0) {
BaseBlock block = FaweCache.CACHE_BLOCK[combinedId];
if (FaweCache.hasNBT(block.getId())) {
if (block.canStoreNBTData()) {
trio.set(x, y, z);
CompoundTag nbt = nbtMap.get(trio);
if (nbt != null) {
@ -357,7 +332,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
last = i;
int combinedId = raf.readChar();
BaseBlock block = FaweCache.CACHE_BLOCK[combinedId];
if (FaweCache.hasNBT(block.getId())) {
if (block.canStoreNBTData()) {
CompoundTag nbt = nbtMap.get(new IntegerTrio(x, y, z));
if (nbt != null) {
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) {
try {
if (byteValue >= 256) {
System.out.println("Add block");
hasAdd = true;
}
if (FaweCache.hasData(byteValue)) {
@ -202,7 +201,6 @@ public class SchematicWriter implements ClipboardWriter {
@Override
public void run(int index, int byteValue) {
try {
System.out.println("Add " + (byteValue >> 8));
rawStream.writeByte(byteValue >> 8);
} catch (IOException e) {
e.printStackTrace();