Class BlockRef

java.lang.Object
nl.pim16aap2.lightkeeper.framework.BlockRef

public final class BlockRef extends Object
LIVE address of a block in a world: it stores where, never what.

Every read re-queries the server; use state() for a frozen BlockStateSnapshot when multiple properties must be read consistently.

  • Method Details

    • pos

      public BlockPos pos()
      Gets this reference's position.
      Returns:
      The block position.
    • worldName

      public String worldName()
      Returns:
      This block address's world name, without querying the server.
    • material

      public String material()
      Gets the block's current material.
      Returns:
      The canonical namespaced material key.
    • state

      public BlockStateSnapshot state()
      Gets a frozen snapshot of the block's full current state.
      Returns:
      The state snapshot.
    • is

      public boolean is(BlockSpec expected)
      Checks whether the block currently matches a spec (partial matching: only the spec's named properties are compared).
      Parameters:
      expected - The expected spec.
      Returns:
      true when the live block matches.