fixed a rare race condition (?) when iterating block entities

closes #329
This commit is contained in:
Ell 2023-09-25 13:35:42 +02:00
parent 1c9d5c1102
commit 41214e7b2f

View file

@ -67,9 +67,11 @@ public final class Helper {
var chunk = Helper.getLoadedChunk(level, x, z);
if (chunk != null) {
for (var tilePos : chunk.getBlockEntitiesPos()) {
if (tilePos.distSqr(pos) <= radius * radius)
if (consumer.apply(chunk.getBlockEntity(tilePos)))
if (tilePos.distSqr(pos) <= radius * radius) {
var tile = chunk.getBlockEntity(tilePos);
if (tile != null && consumer.apply(tile))
return true;
}
}
}
}