Class BlockScan
java.lang.Object
dev.myriadclient.api.world.BlockScan
Fast block searches over a chunk. Each 16×16×16 section keeps a palette of the states it holds, so a section that
can't contain a match is skipped without reading a single block: looking for obsidian or ores usually touches a
handful of sections instead of the ~100,000 blocks of a full chunk. Pair it with
ChunkCache, which calls you
once per chunk as chunks load and change.
BlockScan.forEach(chunk, state -> state.is(Blocks.ANCIENT_DEBRIS), (pos, state) -> found.add(pos.immutable()));
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancontains(net.minecraft.world.level.chunk.LevelChunk chunk, Predicate<net.minecraft.world.level.block.state.BlockState> filter) True if any block inchunkmatches, checking palettes first and stopping at the first match.static voidforEach(net.minecraft.world.level.chunk.LevelChunk chunk, Predicate<net.minecraft.world.level.block.state.BlockState> filter, BlockScan.Visitor visitor) Visits every block inchunkwhose state matchesfilter, bottom to top.
-
Method Details
-
forEach
public static void forEach(net.minecraft.world.level.chunk.LevelChunk chunk, Predicate<net.minecraft.world.level.block.state.BlockState> filter, BlockScan.Visitor visitor) Visits every block inchunkwhose state matchesfilter, bottom to top. A filter that matches air reads every all-air section too, so keep it to the blocks you want. It reads only the chunk, so it suits aChunkCache.async()compute. -
contains
public static boolean contains(net.minecraft.world.level.chunk.LevelChunk chunk, Predicate<net.minecraft.world.level.block.state.BlockState> filter) True if any block inchunkmatches, checking palettes first and stopping at the first match.
-