Interface RedstoneRegistry


public interface RedstoneRegistry
Which block types take part in redstone, and how: the RedstoneBehaviour attached to each of them.
Since:
0.1.0
See Also:
  • Method Details

    • attach

      void attach(TypedKey<BlockType> block, RedstoneBehaviour behaviour, Plugin owner)
      Attaches a behaviour to a block type, in place of the one in effect.
      Parameters:
      block - the block type
      behaviour - its redstone behaviour
      owner - the owner of the attachment, usually the Plugin instance; it is released by detachAll(Plugin)
      Since:
      0.1.0
    • detach

      boolean detach(TypedKey<BlockType> block, Plugin owner)
      Detaches the behaviours an owner attached to a block type.
      Parameters:
      block - the block type
      owner - the owner given when attaching
      Returns:
      true if at least one behaviour was detached
      Since:
      0.1.0
    • detachAll

      void detachAll(Plugin owner)
      Detaches every behaviour an owner attached, whatever the block type.
      Parameters:
      owner - the owner given when attaching
      Since:
      0.1.0
    • behaviour

      Returns the behaviour in effect for a block type, empty for a block taking no part in redstone.
      Parameters:
      block - the block type
      Returns:
      the behaviour in effect for a block type, empty for a block taking no part in redstone
      Since:
      0.1.0
    • behaviour

      default Optional<RedstoneBehaviour> behaviour(BlockData data)
      Returns the behaviour in effect for the type of a state, empty for a block taking no part in redstone.
      Parameters:
      data - the state
      Returns:
      the behaviour in effect for the type of a state, empty for a block taking no part in redstone
      Since:
      0.1.0
    • blocks

      Set<TypedKey<BlockType>> blocks()
      Returns an immutable snapshot of the block types that have a behaviour.
      Returns:
      an immutable snapshot of the block types that have a behaviour
      Since:
      0.1.0