Synchronise chunk filtering

This commit is contained in:
dordsor21 2021-11-02 13:34:37 +00:00
parent d8735da871
commit 0674f39600
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B
2 changed files with 10 additions and 10 deletions

View File

@ -56,7 +56,7 @@ public class CharFilterBlock extends ChunkFilterBlock {
}
@Override
public final ChunkFilterBlock initChunk(int chunkX, int chunkZ) {
public synchronized final ChunkFilterBlock initChunk(int chunkX, int chunkZ) {
this.chunkX = chunkX;
this.chunkZ = chunkZ;
this.xx = chunkX << 4;
@ -65,7 +65,7 @@ public class CharFilterBlock extends ChunkFilterBlock {
}
@Override
public final ChunkFilterBlock initLayer(IBlocks iget, IChunkSet iset, int layer) {
public synchronized final ChunkFilterBlock initLayer(IBlocks iget, IChunkSet iset, int layer) {
this.get = (CharGetBlocks) iget;
minLayer = this.get.getMinSectionPosition();
maxLayer = this.get.getMaxSectionPosition();
@ -88,7 +88,7 @@ public class CharFilterBlock extends ChunkFilterBlock {
}
@Override
public void flood(
public synchronized void flood(
IChunkGet iget, IChunkSet iset, int layer, Flood flood,
FilterBlockMask mask
) {
@ -114,7 +114,7 @@ public class CharFilterBlock extends ChunkFilterBlock {
}
@Override
public void filter(Filter filter, int x, int y, int z) {
public synchronized void filter(Filter filter, int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
@ -123,7 +123,7 @@ public class CharFilterBlock extends ChunkFilterBlock {
}
@Override
public void filter(Filter filter, int startY, int endY) {
public synchronized void filter(Filter filter, int startY, int endY) {
for (y = startY, index = startY << 8; y <= endY; y++) {
for (z = 0; z < 16; z++) {
for (x = 0; x < 16; x++, index++) {
@ -134,7 +134,7 @@ public class CharFilterBlock extends ChunkFilterBlock {
}
@Override
public void filter(Filter filter, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) {
public synchronized void filter(Filter filter, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) {
int yis = minY << 8;
int zis = minZ << 4;
int zie = (15 - maxZ) << 4;
@ -153,7 +153,7 @@ public class CharFilterBlock extends ChunkFilterBlock {
}
@Override
public final void filter(Filter filter, Region region) {
public synchronized final void filter(Filter filter, Region region) {
for (y = 0, index = 0; y < 16; y++) {
int absY = yy + y;
for (z = 0; z < 16; z++) {
@ -169,7 +169,7 @@ public class CharFilterBlock extends ChunkFilterBlock {
}
@Override
public final void filter(Filter filter) {
public synchronized final void filter(Filter filter) {
for (y = 0, index = 0; y < 16; y++) {
for (z = 0; z < 16; z++) {
for (x = 0; x < 16; x++, index++) {

View File

@ -69,7 +69,7 @@ public abstract class ChunkFilterBlock extends AbstractExtentFilterBlock {
/**
* Filter with a chunk object.
*/
public final IChunkSet filter(IChunk chunk, IChunkGet get, IChunkSet set, Filter filter) {
public synchronized final IChunkSet filter(IChunk chunk, IChunkGet get, IChunkSet set, Filter filter) {
initChunk(chunk.getX(), chunk.getZ());
for (int layer = get.getMinSectionPosition(); layer <= get.getMaxSectionPosition(); layer++) {
if (set.hasSection(layer)) {
@ -83,7 +83,7 @@ public abstract class ChunkFilterBlock extends AbstractExtentFilterBlock {
/**
* Filter a chunk with a region / filter.
*/
public final IChunkSet filter(IChunk chunk, IChunkGet get, IChunkSet set, Filter filter, Region region, boolean full) {
public synchronized final IChunkSet filter(IChunk chunk, IChunkGet get, IChunkSet set, Filter filter, Region region, boolean full) {
if (region != null) {
region.filter(chunk, filter, this, get, set, full);
} else {