Fix TE CME on sponge

This commit is contained in:
Jesse Boyd 2018-06-09 06:14:53 +10:00
parent eaedd5442a
commit b8f37feef1
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 18 additions and 8 deletions

View File

@ -259,6 +259,7 @@ public class SpongeChunk_1_11 extends CharFaweChunk<Chunk, SpongeQueue_1_11> {
// Trim tiles // Trim tiles
if (!tiles.isEmpty()) { if (!tiles.isEmpty()) {
synchronized (SpongeChunk_1_11.class) { synchronized (SpongeChunk_1_11.class) {
List<TileEntity> invalidate = null;
Set<Map.Entry<BlockPos, TileEntity>> entryset = tiles.entrySet(); Set<Map.Entry<BlockPos, TileEntity>> entryset = tiles.entrySet();
Iterator<Map.Entry<BlockPos, TileEntity>> iterator = entryset.iterator(); Iterator<Map.Entry<BlockPos, TileEntity>> iterator = entryset.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@ -274,11 +275,15 @@ public class SpongeChunk_1_11 extends CharFaweChunk<Chunk, SpongeQueue_1_11> {
} }
int k = FaweCache.CACHE_J[ly][lz][lx]; int k = FaweCache.CACHE_J[ly][lz][lx];
if (array[k] != 0) { if (array[k] != 0) {
synchronized (SpongeChunk_1_11.class) {
iterator.remove(); iterator.remove();
tile.getValue().invalidate(); if (invalidate == null) invalidate = new ArrayList<>();
invalidate.add(tile.getValue());
} }
} }
if (invalidate != null) {
for (TileEntity tile : invalidate) {
tile.invalidate();
}
} }
} }
} }

View File

@ -259,6 +259,7 @@ public class SpongeChunk_1_12 extends CharFaweChunk<Chunk, SpongeQueue_1_12> {
// Trim tiles // Trim tiles
if (!tiles.isEmpty()) { if (!tiles.isEmpty()) {
synchronized (SpongeChunk_1_12.class) { synchronized (SpongeChunk_1_12.class) {
List<TileEntity> invalidate = null;
Set<Map.Entry<BlockPos, TileEntity>> entryset = tiles.entrySet(); Set<Map.Entry<BlockPos, TileEntity>> entryset = tiles.entrySet();
Iterator<Map.Entry<BlockPos, TileEntity>> iterator = entryset.iterator(); Iterator<Map.Entry<BlockPos, TileEntity>> iterator = entryset.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@ -274,11 +275,15 @@ public class SpongeChunk_1_12 extends CharFaweChunk<Chunk, SpongeQueue_1_12> {
} }
int k = FaweCache.CACHE_J[ly][lz][lx]; int k = FaweCache.CACHE_J[ly][lz][lx];
if (array[k] != 0) { if (array[k] != 0) {
synchronized (SpongeChunk_1_12.class) {
iterator.remove(); iterator.remove();
tile.getValue().invalidate(); if (invalidate == null) invalidate = new ArrayList<>();
invalidate.add(tile.getValue());
} }
} }
if (invalidate != null) {
for (TileEntity tile : invalidate) {
tile.invalidate();
}
} }
} }
} }