Skip to content

Instantly share code, notes, and snippets.

public static List<BlockPos> matchingBlocksOfKindInRange(Level level, BlockPos centerPos, int radius, Predicate<BlockState> predicate) {
List<BlockPos> validPos = new ObjectArrayList<>();
// Figure out how many chunk radius we need to search outward to encompass the radius properly
ChunkPos maxChunkPos = new ChunkPos(
SectionPos.blockToSectionCoord(centerPos.getX() + radius),
SectionPos.blockToSectionCoord(centerPos.getZ() + radius)
);
ChunkPos minChunkPos = new ChunkPos(
https://github.com/Vazkii/Psi/issues/479
https://github.com/GTNewHorizons/NewHorizons/issues/3408