This commit is contained in:
Jesse Boyd 2017-03-18 16:56:53 +11:00
parent 26404fc9db
commit 6ac7782d9a
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F

View File

@ -576,16 +576,16 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
@Override @Override
public boolean hasNext() { public boolean hasNext() {
return (nextX != Integer.MIN_VALUE); return (nextZ != Integer.MIN_VALUE);
} }
@Override @Override
public Vector2D next() { public Vector2D next() {
if (!hasNext()) throw new java.util.NoSuchElementException(); if (!hasNext()) throw new java.util.NoSuchElementException();
Vector2D answer = mutable.setComponents(nextX, nextZ); Vector2D answer = mutable.setComponents(nextX, nextZ);
if (++nextZ > max.getBlockZ()) { if (++nextX > max.getBlockX()) {
nextZ = min.getBlockZ(); nextX = min.getBlockX();
if (++nextX > max.getBlockX()) { if (++nextZ > max.getBlockZ()) {
nextZ = Integer.MIN_VALUE; nextZ = Integer.MIN_VALUE;
} }
} }