Improve LOD Building and Lighting speed for BigGlobe worlds
Thanks Builderb0y!
This commit is contained in:
+3
-2
@@ -44,6 +44,7 @@ public class LodDataBuilder
|
||||
|
||||
|
||||
ChunkSizedFullDataAccessor chunkData = new ChunkSizedFullDataAccessor(chunkWrapper.getChunkPos());
|
||||
int minBuildHeight = chunkWrapper.getMinFilledHeight();
|
||||
|
||||
for (int x = 0; x < LodUtil.CHUNK_WIDTH; x++)
|
||||
{
|
||||
@@ -71,7 +72,7 @@ public class LodDataBuilder
|
||||
}
|
||||
|
||||
|
||||
for (; y >= chunkWrapper.getMinBuildHeight(); y--)
|
||||
for (; y >= minBuildHeight; y--)
|
||||
{
|
||||
IBiomeWrapper newBiome = chunkWrapper.getBiome(x, y, z);
|
||||
IBlockStateWrapper newBlockState = chunkWrapper.getBlockState(x, y, z);
|
||||
@@ -94,7 +95,7 @@ public class LodDataBuilder
|
||||
}
|
||||
longs.add(FullDataPointUtil.encode(mappedId, lastY - y, y + 1 - chunkWrapper.getMinBuildHeight(), light));
|
||||
|
||||
chunkData.setSingleColumn(longs.toArray(new long[0]), x, z);
|
||||
chunkData.setSingleColumn(longs.toLongArray(), x, z);
|
||||
}
|
||||
}
|
||||
if (!canGenerateLodFromChunk(chunkWrapper)) return null;
|
||||
|
||||
@@ -244,7 +244,7 @@ public class DhLightingEngine
|
||||
continue;
|
||||
}
|
||||
|
||||
if (relNeighbourBlockPos.y < neighbourChunk.getMinBuildHeight() || relNeighbourBlockPos.y > neighbourChunk.getMaxBuildHeight())
|
||||
if (relNeighbourBlockPos.y < neighbourChunk.getMinFilledHeight() || relNeighbourBlockPos.y > neighbourChunk.getMaxBuildHeight())
|
||||
{
|
||||
// the light pos is outside the chunk's min/max height,
|
||||
// this can happen if given a chunk that hasn't finished generating
|
||||
|
||||
+6
@@ -39,6 +39,12 @@ public interface IChunkWrapper extends IBindable
|
||||
int getMinBuildHeight();
|
||||
int getMaxBuildHeight();
|
||||
|
||||
/**
|
||||
* returns the Y level for the first non-empty section in this chunk,
|
||||
* or {@link Integer#MAX_VALUE} if this chunk is completely empty.
|
||||
*/
|
||||
int getMinFilledHeight();
|
||||
|
||||
/** @return The highest y position of a solid block at the given relative chunk position. */
|
||||
int getSolidHeightMapValue(int xRel, int zRel);
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user