Interface SignalGetter

All Superinterfaces:
BlockGetter
All Known Subinterfaces:
RedstoneWorld

public interface SignalGetter extends BlockGetter
Read access to the blocks of a world and to the redstone signals running through them.
Since:
0.1.0
See Also:
  • Method Details

    • world

      World world()
      Returns the world these signals run in.
      Returns:
      the world these signals run in
      Since:
      0.1.0
    • signal

      int signal(BlockPosition position, BlockFace direction)
      Gets the signal a block powers its neighbour with: the weak signal it emits, or, for a conductor, the strongest strong signal it receives when that is higher.
      Parameters:
      position - the block emitting the signal
      direction - the direction from the block reading the signal to position
      Returns:
      the signal, from 0 to 15
      Since:
      0.1.0
    • hasSignal

      default boolean hasSignal(BlockPosition position, BlockFace direction)
      Returns true if signal(BlockPosition, BlockFace) is above 0.
      Parameters:
      position - the block emitting the signal
      direction - the direction from the block reading the signal to position
      Returns:
      true if signal(BlockPosition, BlockFace) is above 0
      Since:
      0.1.0
    • directSignal

      int directSignal(BlockPosition position, BlockFace direction)
      Gets the strong signal a block emits towards one of its neighbours, the one that powers a conductor through.
      Parameters:
      position - the block emitting the signal
      direction - the direction from the block reading the signal to position
      Returns:
      the signal, from 0 to 15
      Since:
      0.1.0
    • directSignalTo

      int directSignalTo(BlockPosition position)
      Returns the strongest strong signal a block receives from its six neighbours.
      Parameters:
      position - the block receiving the signals
      Returns:
      the strongest strong signal a block receives from its six neighbours
      Since:
      0.1.0
    • bestNeighborSignal

      int bestNeighborSignal(BlockPosition position)
      Returns the strongest signal a block receives from its six neighbours, from 0 to 15.
      Parameters:
      position - the block receiving the signals
      Returns:
      the strongest signal a block receives from its six neighbours, from 0 to 15
      Since:
      0.1.0
    • hasNeighborSignal

      boolean hasNeighborSignal(BlockPosition position)
      Returns true when at least one of the six neighbours of a block powers it, what a door, a lamp or a piston listens to.
      Parameters:
      position - the block receiving the signals
      Returns:
      true when at least one of the six neighbours of a block powers it, what a door, a lamp or a piston listens to
      Since:
      0.1.0
    • controlInputSignal

      int controlInputSignal(BlockPosition position, BlockFace direction, boolean diodesOnly)
      Gets the signal a block feeds into the side of a repeater or a comparator.
      Parameters:
      position - the block on the side of the repeater or comparator
      direction - the direction from the repeater or comparator to position
      diodesOnly - true to only accept repeaters and comparators, what locks a repeater
      Returns:
      the signal, from 0 to 15
      Since:
      0.1.0
    • hasAnalogOutput

      boolean hasAnalogOutput(BlockPosition position)
      Returns true if a comparator can read a level out of the block, such as how full a container is.
      Parameters:
      position - the block to read
      Returns:
      true if a comparator can read a level out of the block, such as how full a container is
      Since:
      0.1.0
      See Also:
    • analogOutput

      int analogOutput(BlockPosition position, BlockFace direction)
      Gets the level a comparator reads out of a block.
      Parameters:
      position - the block to read
      direction - the direction from the comparator to position
      Returns:
      the level, from 0 to 15, 0 for a block with no analog output
      Since:
      0.1.0
    • isConductor

      boolean isConductor(BlockPosition position)
      Returns true if the block conducts power: a full, opaque block such as stone, but not glass, glowstone or a block of redstone.
      Parameters:
      position - the block
      Returns:
      true if the block conducts power: a full, opaque block such as stone, but not glass, glowstone or a block of redstone
      Since:
      0.1.0
    • isFaceSturdy

      boolean isFaceSturdy(BlockPosition position, BlockFace face, SupportType support)
      Returns true if a face of the block can hold a block attached to it.
      Parameters:
      position - the block
      face - the face, as seen from the block itself: BlockFace.UP for its top
      support - how much of the face must be covered
      Returns:
      true if a face of the block can hold a block attached to it
      Since:
      0.1.0