Make scanChunkInto even faster

This commit is contained in:
Logan Darklock 2019-08-31 01:00:37 -07:00
parent ae6ee5688c
commit efa243386c
No known key found for this signature in database
GPG Key ID: B8C37CEDE1AC60EA

View File

@ -116,9 +116,10 @@ public enum WorldScanner implements IWorldScanner {
IBlockStateContainer bsc = (IBlockStateContainer) extendedblockstorage.getData(); IBlockStateContainer bsc = (IBlockStateContainer) extendedblockstorage.getData();
// the mapping of BlockStateContainer.getIndex from xyz to index is y << 8 | z << 4 | x; // the mapping of BlockStateContainer.getIndex from xyz to index is y << 8 | z << 4 | x;
// for better cache locality, iterate in that order // for better cache locality, iterate in that order
int[] storage = bsc.storageArray();
int imax = 1 << 12; int imax = 1 << 12;
for (int i = 0; i < imax; i++) { for (int i = 0; i < imax; i++) {
IBlockState state = bsc.getFast(i); IBlockState state = bsc.getAtPalette(storage[i]);
if (filter.has(state)) { if (filter.has(state)) {
int y = yReal | (i >> 8 & 15); int y = yReal | (i >> 8 & 15);
if (result.size() >= max) { if (result.size() >= max) {