mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 11:53:29 +01:00
fixed a rare race condition (?) when iterating block entities
closes #329
This commit is contained in:
parent
1c9d5c1102
commit
41214e7b2f
1 changed files with 4 additions and 2 deletions
|
@ -67,13 +67,15 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue