Class BlockUtil

java.lang.Object
my.celium.org.util.BlockUtil

public final class BlockUtil extends Object
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 Type
    Method
    Description
    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 matching predicate in a cube around center, checked closest-first.
    static net.minecraft.world.level.block.state.BlockState
    getState(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos)
     
    static boolean
    isAir(net.minecraft.world.level.block.state.BlockState state)
     
    static boolean
    isAir(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos)
     
    static boolean
    isLava(net.minecraft.world.level.block.state.BlockState state)
     
    static boolean
    isOpaque(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos)
    Opaque full cube (redstone-blocking, vision-blocking).
    static boolean
    isReplaceable(net.minecraft.world.level.block.state.BlockState state)
     
    static boolean
    isWater(net.minecraft.world.level.block.state.BlockState state)
     
    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).
    static boolean
    setBlockAndUpdate(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 matching predicate in a cube around center, checked closest-first. Bounded: radius is clamped to 1..16. Never scans the whole world.