9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00

Fix entity bounding box traverse blocks iterate

Reset both x and y values on z level iteration , to prevent skip entire y level loop on z level iteration and cause some issues, e.g. inconsistent with vanilla
This commit is contained in:
Dreeam
2025-06-13 04:07:23 +08:00
parent 71e5da40da
commit a11f042109

View File

@@ -46,7 +46,7 @@ public final class BlockPosIterator extends AbstractIterator<BlockPos> {
MutableBlockPos pos = this.pos; MutableBlockPos pos = this.pos;
if (pos == null) { if (pos == null) {
return this.pos = new MutableBlockPos(this.startX, this.startY, this.startZ); return this.pos = new MutableBlockPos(this.startX, this.startY, this.startZ);
} else { }
int x = pos.getX(); int x = pos.getX();
int y = pos.getY(); int y = pos.getY();
int z = pos.getZ(); int z = pos.getZ();
@@ -59,6 +59,7 @@ public final class BlockPosIterator extends AbstractIterator<BlockPos> {
} else if (z < this.endZ) { } else if (z < this.endZ) {
z += 1; z += 1;
x = this.startX; x = this.startX;
y = this.startY; // Reset y also!
} else { } else {
return this.endOfData(); return this.endOfData();
} }
@@ -67,4 +68,3 @@ public final class BlockPosIterator extends AbstractIterator<BlockPos> {
return pos; return pos;
} }
} }
}