rearranged loop order
This commit is contained in:
parent
e7d41ba4fc
commit
69d8bd56fa
@ -80,10 +80,12 @@ public final class ChunkPacker implements Helper {
|
|||||||
}
|
}
|
||||||
BlockStateContainer bsc = extendedblockstorage.getData();
|
BlockStateContainer bsc = extendedblockstorage.getData();
|
||||||
int yReal = y0 << 4;
|
int yReal = y0 << 4;
|
||||||
for (int x = 0; x < 16; x++) {
|
// the mapping of BlockStateContainer.getIndex from xyz to index is y << 8 | z << 4 | x;
|
||||||
for (int y1 = 0; y1 < 16; y1++) {
|
// for better cache locality, iterate in that order
|
||||||
for (int z = 0; z < 16; z++) {
|
for (int y1 = 0; y1 < 16; y1++) {
|
||||||
int y = y1 | yReal;
|
int y = y1 | yReal;
|
||||||
|
for (int z = 0; z < 16; z++) {
|
||||||
|
for (int x = 0; x < 16; x++) {
|
||||||
int index = CachedChunk.getPositionIndex(x, y, z);
|
int index = CachedChunk.getPositionIndex(x, y, z);
|
||||||
IBlockState state = bsc.get(x, y1, z);
|
IBlockState state = bsc.get(x, y1, z);
|
||||||
boolean[] bits = getPathingBlockType(state).getBits();
|
boolean[] bits = getPathingBlockType(state).getBits();
|
||||||
|
@ -73,9 +73,11 @@ public enum WorldScanner implements Helper {
|
|||||||
}
|
}
|
||||||
int yReal = y0 << 4;
|
int yReal = y0 << 4;
|
||||||
BlockStateContainer bsc = extendedblockstorage.getData();
|
BlockStateContainer bsc = extendedblockstorage.getData();
|
||||||
for (int x = 0; x < 16; x++) {
|
// the mapping of BlockStateContainer.getIndex from xyz to index is y << 8 | z << 4 | x;
|
||||||
for (int y = 0; y < 16; y++) {
|
// for better cache locality, iterate in that order
|
||||||
for (int z = 0; z < 16; z++) {
|
for (int y = 0; y < 16; y++) {
|
||||||
|
for (int z = 0; z < 16; z++) {
|
||||||
|
for (int x = 0; x < 16; x++) {
|
||||||
IBlockState state = bsc.get(x, y, z);
|
IBlockState state = bsc.get(x, y, z);
|
||||||
if (asBlocks.contains(state.getBlock())) {
|
if (asBlocks.contains(state.getBlock())) {
|
||||||
res.add(new BlockPos(chunkX | x, yReal | y, chunkZ | z));
|
res.add(new BlockPos(chunkX | x, yReal | y, chunkZ | z));
|
||||||
|
Loading…
Reference in New Issue
Block a user