Class BlockUtil
java.lang.Object
my.celium.org.util.BlockUtil
Small cohesive block helpers. Thin wrappers over
Level plus the
one scan every QoL mod rewrites (findNearbyBlock(Level, BlockPos, int, Predicate)).-
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<net.minecraft.core.BlockPos> findNearbyBlock(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos center, int radius, Predicate<net.minecraft.world.level.block.state.BlockState> predicate) Finds the nearest block matchingpredicatein a cube aroundcenter, checked closest-first.static net.minecraft.world.level.block.state.BlockStategetState(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) static booleanisAir(net.minecraft.world.level.block.state.BlockState state) static booleanisAir(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) static booleanisLava(net.minecraft.world.level.block.state.BlockState state) static booleanisOpaque(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos) Opaque full cube (redstone-blocking, vision-blocking).static booleanisReplaceable(net.minecraft.world.level.block.state.BlockState state) static booleanisWater(net.minecraft.world.level.block.state.BlockState state) static booleansetBlock(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) Sets a block with default flags (update neighbours + re-render).static booleansetBlockAndUpdate(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
-
Method Details
-
getState
public static net.minecraft.world.level.block.state.BlockState getState(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) -
setBlock
public static boolean setBlock(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) Sets a block with default flags (update neighbours + re-render). -
setBlockAndUpdate
public static boolean setBlockAndUpdate(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) -
isAir
public static boolean isAir(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) -
isAir
public static boolean isAir(net.minecraft.world.level.block.state.BlockState state) -
isWater
public static boolean isWater(net.minecraft.world.level.block.state.BlockState state) -
isLava
public static boolean isLava(net.minecraft.world.level.block.state.BlockState state) -
isReplaceable
public static boolean isReplaceable(net.minecraft.world.level.block.state.BlockState state) -
isOpaque
public static boolean isOpaque(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos) Opaque full cube (redstone-blocking, vision-blocking). -
findNearbyBlock
public static Optional<net.minecraft.core.BlockPos> findNearbyBlock(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos center, int radius, Predicate<net.minecraft.world.level.block.state.BlockState> predicate) Finds the nearest block matchingpredicatein a cube aroundcenter, checked closest-first. Bounded: radius is clamped to1..16. Never scans the whole world.
-