Fix: Make the chunk relevance region iterator actually terminate
@@ -203,8 +203,10 @@ public void chunkUnloaded(Vector3ic pos) {
private class NeededChunksIterator implements Iterator<Vector3i> {
Vector3i nextChunkPos;
+ Iterator<Vector3ic> allPositions;
NeededChunksIterator() {
+ allPositions = currentRegion.iterator();
calculateNext();
}
@@ -227,7 +229,8 @@ public void remove() {
private void calculateNext() {
nextChunkPos = null;
- for (Vector3ic regionPosition : currentRegion) {
+ while (allPositions.hasNext()) {
+ Vector3ic regionPosition = allPositions.next();
if (!relevantChunks.contains(regionPosition)) {
nextChunkPos = new Vector3i(regionPosition);
return;
