remove extra method call

This commit is contained in:
Wagyourtail 2023-01-28 01:39:58 -07:00
parent 334d9c119b
commit 6de266a106
No known key found for this signature in database
GPG Key ID: 0D30679891BED858
1 changed files with 26 additions and 29 deletions

View File

@ -193,41 +193,15 @@ public enum FasterWorldScanner implements IWorldScanner {
return;
}
int yOffset = section.getYLocation();
BitArray array = ((IBlockStateContainer) section.getData()).getStorage();
collectBlockLocations(array, isInFilter, blocks, chunkX, chunkZ, yOffset);
}
private boolean[] getIncludedFilterIndices(BlockOptionalMetaLookup lookup, IBlockStatePalette palette) {
boolean commonBlockFound = false;
ObjectIntIdentityMap<IBlockState> paletteMap = getPalette(palette);
int size = paletteMap.size();
boolean[] isInFilter = new boolean[size];
for (int i = 0; i < size; i++) {
IBlockState state = paletteMap.getByValue(i);
if (lookup.has(state)) {
isInFilter[i] = true;
commonBlockFound = true;
} else {
isInFilter[i] = false;
}
}
if (!commonBlockFound) {
return new boolean[0];
}
return isInFilter;
}
private static void collectBlockLocations(BitArray array, boolean[] isInFilter, List<BlockPos> blocks, long chunkX, long chunkZ, int yOffset) {
long[] longArray = array.getBackingLongArray();
int arraySize = array.size();
int bitsPerEntry = ((IBitArray) array).getBitsPerEntry();
long maxEntryValue = ((IBitArray) array).getMaxEntryValue();
int yOffset = section.getYLocation();
for (int idx = 0, kl = bitsPerEntry - 1; idx < arraySize; idx++, kl += bitsPerEntry) {
final int i = idx * bitsPerEntry;
final int j = i >> 6;
@ -257,6 +231,29 @@ public enum FasterWorldScanner implements IWorldScanner {
}
}
private boolean[] getIncludedFilterIndices(BlockOptionalMetaLookup lookup, IBlockStatePalette palette) {
boolean commonBlockFound = false;
ObjectIntIdentityMap<IBlockState> paletteMap = getPalette(palette);
int size = paletteMap.size();
boolean[] isInFilter = new boolean[size];
for (int i = 0; i < size; i++) {
IBlockState state = paletteMap.getByValue(i);
if (lookup.has(state)) {
isInFilter[i] = true;
commonBlockFound = true;
} else {
isInFilter[i] = false;
}
}
if (!commonBlockFound) {
return new boolean[0];
}
return isInFilter;
}
/**
* cheats to get the actual map of id -> blockstate from the various palette implementations
*/