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:
@@ -46,25 +46,25 @@ 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 y = pos.getY();
|
|
||||||
int z = pos.getZ();
|
|
||||||
|
|
||||||
if (y < this.endY) {
|
|
||||||
y += 1;
|
|
||||||
} else if (x < this.endX) {
|
|
||||||
x += 1;
|
|
||||||
y = this.startY;
|
|
||||||
} else if (z < this.endZ) {
|
|
||||||
z += 1;
|
|
||||||
x = this.startX;
|
|
||||||
} else {
|
|
||||||
return this.endOfData();
|
|
||||||
}
|
|
||||||
|
|
||||||
pos.set(x, y, z);
|
|
||||||
return pos;
|
|
||||||
}
|
}
|
||||||
|
int x = pos.getX();
|
||||||
|
int y = pos.getY();
|
||||||
|
int z = pos.getZ();
|
||||||
|
|
||||||
|
if (y < this.endY) {
|
||||||
|
y += 1;
|
||||||
|
} else if (x < this.endX) {
|
||||||
|
x += 1;
|
||||||
|
y = this.startY;
|
||||||
|
} else if (z < this.endZ) {
|
||||||
|
z += 1;
|
||||||
|
x = this.startX;
|
||||||
|
y = this.startY; // Reset y also!
|
||||||
|
} else {
|
||||||
|
return this.endOfData();
|
||||||
|
}
|
||||||
|
|
||||||
|
pos.set(x, y, z);
|
||||||
|
return pos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user