Interface BlockData

All Known Subinterfaces:
Ageable, Bisected, Directional, Door, Levelled, Lightable, NoteBlock, Openable, Orientable, Powerable, Rotatable, Slab, Snowable, Stairs, Waterlogged

public interface BlockData
One state of a BlockType: the block plus a value for each of its properties.

States are immutable and shared; with(String, String) and the with... methods of the traits in fr.fidorial.world.block.data return another state.

Since:
0.1.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Key
    The key of plain air.
    static final Key
    The key of cave air.
    static final Key
    The key of void air, below the world.
  • Method Summary

    Modifier and Type
    Method
    Description
    default String
    Returns this state in command syntax, for instance minecraft:oak_stairs[facing=north].
    get(String property)
    Gets the value of a property.
    default boolean
    Returns true for any kind of air.
    default Key
    key()
    Returns the key of the block type of this state.
    int
    Returns the network identifier of this state.
    Returns every property value of this state, in declaration order.
    Returns the block type of this state.
    with(String property, String value)
    Returns the state of the same block with one property changed.
  • Field Details

    • AIR

      static final Key AIR
      The key of plain air.
      Since:
      0.1.0
    • CAVE_AIR

      static final Key CAVE_AIR
      The key of cave air.
      Since:
      0.1.0
    • VOID_AIR

      static final Key VOID_AIR
      The key of void air, below the world.
      Since:
      0.1.0
  • Method Details

    • type

      BlockType type()
      Returns the block type of this state.
      Returns:
      the block type of this state
      Since:
      0.1.0
    • key

      default Key key()
      Returns the key of the block type of this state.
      Returns:
      the key of the block type of this state
      Since:
      0.1.0
    • networkId

      int networkId()
      Returns the network identifier of this state.
      Returns:
      the network identifier of this state
      Since:
      0.1.0
    • get

      @Nullable String get(String property)
      Gets the value of a property.
      Parameters:
      property - the property name
      Returns:
      the value, or null if the block has no such property
      Since:
      0.1.0
    • with

      BlockData with(String property, String value)
      Returns the state of the same block with one property changed.
      Parameters:
      property - the property name
      value - the new value
      Returns:
      the state of the same block with one property changed
      Throws:
      IllegalArgumentException - if the property or value is unknown to this block
      Since:
      0.1.0
    • propertyMap

      Map<String,String> propertyMap()
      Returns every property value of this state, in declaration order.
      Returns:
      every property value of this state, in declaration order
      Since:
      0.1.0
    • isAir

      default boolean isAir()
      Returns true for any kind of air.
      Returns:
      true for any kind of air
      Since:
      0.1.0
    • asString

      default String asString()
      Returns this state in command syntax, for instance minecraft:oak_stairs[facing=north].
      Returns:
      this state in command syntax, for instance minecraft:oak_stairs[facing=north]
      Since:
      0.1.0