This commit is contained in:
Jesse Boyd 2017-04-20 16:54:57 +10:00
parent f0e310da6d
commit a08b68cac4
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
3 changed files with 45 additions and 35 deletions

View File

@ -85,7 +85,9 @@ public class RollbackOptimizedHistory extends DiskStorageHistory {
if (super.close()) {
// Save to DB
RollbackDatabase db = DBHandler.IMP.getDatabase(getWorld());
db.logEdit(this);
if (db != null) {
db.logEdit(this);
}
return true;
}
return false;

View File

@ -256,23 +256,27 @@ public class ForgeChunk_All extends CharFaweChunk<Chunk, ForgeQueue_All> {
getParent().getChangeTask().run(previous, this);
}
// Trim tiles
Set<Map.Entry<BlockPos, TileEntity>> entryset = tiles.entrySet();
Iterator<Map.Entry<BlockPos, TileEntity>> iterator = entryset.iterator();
while (iterator.hasNext()) {
Map.Entry<BlockPos, TileEntity> tile = iterator.next();
BlockPos pos = tile.getKey();
int lx = pos.getX() & 15;
int ly = pos.getY();
int lz = pos.getZ() & 15;
int j = FaweCache.CACHE_I[ly][lz][lx];
char[] array = this.getIdArray(j);
if (array == null) {
continue;
}
int k = FaweCache.CACHE_J[ly][lz][lx];
if (array[k] != 0) {
tile.getValue().invalidate();;
iterator.remove();
if (!tiles.isEmpty()) {
Set<Map.Entry<BlockPos, TileEntity>> entryset = tiles.entrySet();
Iterator<Map.Entry<BlockPos, TileEntity>> iterator = entryset.iterator();
while (iterator.hasNext()) {
Map.Entry<BlockPos, TileEntity> tile = iterator.next();
BlockPos pos = tile.getKey();
int lx = pos.getX() & 15;
int ly = pos.getY();
int lz = pos.getZ() & 15;
int j = FaweCache.CACHE_I[ly][lz][lx];
char[] array = this.getIdArray(j);
if (array == null) {
continue;
}
int k = FaweCache.CACHE_J[ly][lz][lx];
if (array[k] != 0) {
synchronized (ForgeChunk_All.class) {
tile.getValue().invalidate();
iterator.remove();
}
}
}
}
// Efficiently merge sections

View File

@ -256,23 +256,27 @@ public class SpongeChunk_1_11 extends CharFaweChunk<Chunk, SpongeQueue_1_11> {
getParent().getChangeTask().run(previous, this);
}
// Trim tiles
Set<Map.Entry<BlockPos, TileEntity>> entryset = tiles.entrySet();
Iterator<Map.Entry<BlockPos, TileEntity>> iterator = entryset.iterator();
while (iterator.hasNext()) {
Map.Entry<BlockPos, TileEntity> tile = iterator.next();
BlockPos pos = tile.getKey();
int lx = pos.getX() & 15;
int ly = pos.getY();
int lz = pos.getZ() & 15;
int j = FaweCache.CACHE_I[ly][lz][lx];
char[] array = this.getIdArray(j);
if (array == null) {
continue;
}
int k = FaweCache.CACHE_J[ly][lz][lx];
if (array[k] != 0) {
tile.getValue().invalidate();;
iterator.remove();
if (!tiles.isEmpty()) {
Set<Map.Entry<BlockPos, TileEntity>> entryset = tiles.entrySet();
Iterator<Map.Entry<BlockPos, TileEntity>> iterator = entryset.iterator();
while (iterator.hasNext()) {
Map.Entry<BlockPos, TileEntity> tile = iterator.next();
BlockPos pos = tile.getKey();
int lx = pos.getX() & 15;
int ly = pos.getY();
int lz = pos.getZ() & 15;
int j = FaweCache.CACHE_I[ly][lz][lx];
char[] array = this.getIdArray(j);
if (array == null) {
continue;
}
int k = FaweCache.CACHE_J[ly][lz][lx];
if (array[k] != 0) {
synchronized (SpongeChunk_1_11.class) {
tile.getValue().invalidate();
iterator.remove();
}
}
}
}
HashSet<UUID> entsToRemove = this.getEntityRemoves();