Improve LOD Building and Lighting speed for BigGlobe worlds

Thanks Builderb0y!
This commit is contained in:
James Seibel
2023-09-11 07:26:09 -05:00
parent e4a7056d48
commit c1fda715d0
2 changed files with 17 additions and 1 deletions
@@ -31,6 +31,7 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.IChunkWrapper;
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IBiomeWrapper;
import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper;
import com.seibel.distanthorizons.coreapi.util.BitShiftUtil;
import net.minecraft.client.multiplayer.ClientChunkCache;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.core.BlockPos;
@@ -149,6 +150,21 @@ public class ChunkWrapper implements IChunkWrapper
@Override
public int getMaxBuildHeight() { return this.chunk.getMaxBuildHeight(); }
@Override
public int getMinFilledHeight()
{
LevelChunkSection[] sections = this.chunk.getSections();
for (int index = 0; index < sections.length; index++)
{
if (!sections[index].hasOnlyAir())
{
// convert from an index to a block coordinate
return this.chunk.getSectionYFromSectionIndex(index) * 16;
}
}
return Integer.MAX_VALUE;
}
@Override
public int getSolidHeightMapValue(int xRel, int zRel) { return this.chunk.getOrCreateHeightmapUnprimed(Heightmap.Types.WORLD_SURFACE).getFirstAvailable(xRel, zRel); }