diff --git a/core/src/main/java/com/seibel/distanthorizons/core/render/LodQuadTree.java b/core/src/main/java/com/seibel/distanthorizons/core/render/LodQuadTree.java index 731cba4d7..2c32c7e55 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/render/LodQuadTree.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/render/LodQuadTree.java @@ -302,13 +302,9 @@ public class LodQuadTree extends QuadTree implements IDebugRen boolean allChildrenSectionsAreLoaded = true; // recursively update all child render sections - LongIterator childPosIterator = quadNode.getChildPosIterator(); - while (childPosIterator.hasNext()) + for (int i = 0; i < 4; i++) { - long childPos = childPosIterator.nextLong(); - QuadNode childNode = rootNode.getNode(childPos); - - boolean childSectionLoaded = this.recursivelyUpdateRenderSectionNode(playerPos, rootNode, childNode, childPos, thisPosIsRendering || parentSectionIsRendering, nodesNeedingRetrieval, nodesNeedingLoading); + boolean childSectionLoaded = this.recursivelyUpdateRenderSectionNode(playerPos, rootNode, quadNode.getChildByIndex(i), DhSectionPos.getChildByIndex(sectionPos, i), thisPosIsRendering || parentSectionIsRendering, nodesNeedingRetrieval, nodesNeedingLoading); allChildrenSectionsAreLoaded = childSectionLoaded && allChildrenSectionsAreLoaded; } @@ -335,13 +331,9 @@ public class LodQuadTree extends QuadTree implements IDebugRen renderSection.renderingEnabled = false; // walk back down the tree and enable the child sections //TODO there are probably more efficient ways of doing this, but this will work for now - childPosIterator = quadNode.getChildPosIterator(); - while (childPosIterator.hasNext()) + for (int i = 0; i < 4; i++) { - long childPos = childPosIterator.nextLong(); - QuadNode childNode = rootNode.getNode(childPos); - - boolean childSectionLoaded = this.recursivelyUpdateRenderSectionNode(playerPos, rootNode, childNode, childPos, parentSectionIsRendering, nodesNeedingRetrieval, nodesNeedingLoading); + boolean childSectionLoaded = this.recursivelyUpdateRenderSectionNode(playerPos, rootNode, quadNode.getChildByIndex(i), DhSectionPos.getChildByIndex(sectionPos, i), parentSectionIsRendering, nodesNeedingRetrieval, nodesNeedingLoading); allChildrenSectionsAreLoaded = childSectionLoaded && allChildrenSectionsAreLoaded; } if (!allChildrenSectionsAreLoaded)