Interface BlockRegistry


public interface BlockRegistry
Every block type the server knows, vanilla and plugin-defined.
Since:
0.1.0
See Also:
  • Method Details

    • type

      Optional<BlockType> type(Key key)
      Returns the block type registered under a key, if any.
      Parameters:
      key - the block key
      Returns:
      the block type registered under a key, if any
      Since:
      0.1.0
    • type

      default Optional<BlockType> type(@KeyPattern String key)
      Returns the block type registered under a key, if any.
      Parameters:
      key - the block key, for instance minecraft:stone
      Returns:
      the block type registered under a key, if any
      Since:
      0.1.0
    • fromNetworkId

      @Nullable BlockData fromNetworkId(int networkId)
      Returns the state with the given network identifier, or null if it is unknown.
      Parameters:
      networkId - the network identifier
      Returns:
      the state with the given network identifier, or null if it is unknown
      Since:
      0.1.0
    • register

      void register(BlockType type)
      Registers a block type.
      Parameters:
      type - the block type
      Since:
      0.1.0
    • register

      default void register(BlockBehaviour behaviour)
      Registers the block type a behaviour drives.
      Parameters:
      behaviour - the behaviour
      Since:
      0.1.0
    • behaviour

      default Optional<BlockBehaviour> behaviour(Key key)
      Returns the behaviour driving a block type, if any.
      Parameters:
      key - the block key
      Returns:
      the behaviour driving a block type, if any
      Since:
      0.1.0
    • behaviour

      default Optional<BlockBehaviour> behaviour(BlockData data)
      Returns the behaviour driving the type of a state, if any.
      Parameters:
      data - the state
      Returns:
      the behaviour driving the type of a state, if any
      Since:
      0.1.0
    • types

      Returns every registered block type.
      Returns:
      every registered block type
      Since:
      0.1.0
    • parse

      default @Nullable BlockData parse(String input)
      Parses a state in command syntax, for instance minecraft:oak_stairs[facing=north].
      Parameters:
      input - the state to parse
      Returns:
      the state, or null if the block is unknown
      Throws:
      IllegalArgumentException - if the syntax is malformed or a property is unknown
      Since:
      0.1.0