Merge branch '1.16.5' of gitlab.com:jeseibel/minecraft-lod-mod into 1.16.5

This commit is contained in:
James Seibel
2021-08-14 08:20:09 -05:00
2 changed files with 28 additions and 2 deletions
@@ -25,6 +25,7 @@ import java.util.concurrent.Executors;
import com.seibel.lod.enums.DistanceGenerationMode;
import com.seibel.lod.enums.LodDetail;
import com.seibel.lod.handlers.LodConfig;
import com.seibel.lod.objects.LodDataPoint;
import com.seibel.lod.objects.LodQuadTreeDimension;
import com.seibel.lod.objects.LodQuadTreeNode;
@@ -139,7 +140,7 @@ public class LodNodeBuilder
public List<LodQuadTreeNode> generateLodNodeFromChunk(IChunk chunk, LodBuilderConfig config)
throws IllegalArgumentException
{
LodDetail detail = LodDetail.FULL;
LodDetail detail = LodConfig.CLIENT.maxGenerationDetail.get();
List<LodQuadTreeNode> lodNodeList = new ArrayList<>();
if (chunk == null)
throw new IllegalArgumentException("generateLodFromChunk given a null chunk");
@@ -328,7 +328,32 @@ public class LodQuadTree
children[NS][WE] = new LodQuadTree(this, (byte) (lodNode.detailLevel - 1), new RegionPos(childRegionX, childRegionZ));
}
/**
* Delete all the children
*/
public void deleteChildren()
{
children = new LodQuadTree[2][2];
}
/**
* Cut the tree at the given target level
*/
public void cutTreeAtLevel(byte targetLevel) {
if (targetLevel <= lodNode.detailLevel) {
deleteChildren();
} else {
for (int NS = 0; NS <= 1; NS++) {
for (int WE = 0; WE <= 1; WE++) {
if (getChild(NS, WE) != null) {
getChild(NS, WE).cutTreeAtLevel(targetLevel);
}
}
}
}
}
/**
* Update this region's data, specifically levelFull and lodNodeData.
*