Skip to content

Commit

Permalink
avoid premature trimming
Browse files Browse the repository at this point in the history
  • Loading branch information
SirYwell committed Oct 22, 2023
1 parent 6dfa7d1 commit 1c41ec6
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,23 @@ public IChunkSet processSet(IChunk chunk, IChunkGet get, IChunkSet set) {
int bz = chunk.getZ() << 4;
int tx = bx + 15;
int tz = bz + 15;
List<Region> intersecting = new ArrayList<>(2);
for (Region region : regions) {
BlockVector3 regMin = region.getMinimumPoint();
BlockVector3 regMax = region.getMaximumPoint();
if (tx >= regMin.getX() && bx <= regMax.getX() && tz >= regMin.getZ() && bz <= regMax.getZ()) {
return region.processSet(chunk, get, set);
intersecting.add(region);
}
}
return null;
if (intersecting.isEmpty()) {
return null;
}
if (intersecting.size() == 1) {
return intersecting.get(0).processSet(chunk, get, set);
}
// if multiple regions intersect with this chunk, we must be more careful, otherwise one region might trim content of
// another region
return super.processSet(chunk, get, set);
}

@Override
Expand Down

0 comments on commit 1c41ec6

Please sign in to comment.