Skip to content

Commit 4a5ad80

Browse files
committed
fix nether pathfinder exception in palette scan
1 parent e7a2b83 commit 4a5ad80

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/java/baritone/process/elytra/NetherPathfinderContext.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,13 @@ private static void writeChunkData(LevelChunk chunk, long ptr) {
196196
continue;
197197
}
198198
final PalettedContainer<BlockState> bsc = extendedblockstorage.getStates();
199-
final int airId = ((IPalettedContainer<BlockState>) bsc).getPalette().idFor(AIR_BLOCK_STATE, PaletteResize.noResizeExpected());
199+
IPalettedContainer<BlockState> iPalettedContainer = (IPalettedContainer<BlockState>) bsc;
200+
int airId = -1;
201+
if (iPalettedContainer.getPalette().maybeHas(state -> state.equals(AIR_BLOCK_STATE))) {
202+
airId = iPalettedContainer.getPalette().idFor(AIR_BLOCK_STATE, PaletteResize.noResizeExpected());
203+
}
200204
// pasted from FasterWorldScanner
201-
final BitStorage array = ((IPalettedContainer<BlockState>) bsc).getStorage();
205+
final BitStorage array = iPalettedContainer.getStorage();
202206
if (array == null) continue;
203207
final long[] longArray = array.getRaw();
204208
final int arraySize = array.getSize();

0 commit comments

Comments
 (0)