Interface BlockBehaviour


public interface BlockBehaviour
The server-side logic of a block type: how it is placed and how it interacts with light.
Since:
0.1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    default Key
    key()
    Returns the key of the block type this behaviour drives.
    default int
    Returns the light level the state emits, from 0 to 15.
    default int
    Returns how much light the state absorbs, from 0 (transparent) to 15 (opaque).
    Chooses the state a player places, for instance facing the player.
    Returns the block type this behaviour drives.
  • Method Details

    • type

      BlockType type()
      Returns the block type this behaviour drives.
      Returns:
      the block type this behaviour drives
      Since:
      0.1.0
    • key

      default Key key()
      Returns the key of the block type this behaviour drives.
      Returns:
      the key of the block type this behaviour drives
      Since:
      0.1.0
    • placementState

      default @Nullable BlockData placementState(BlockPlaceContext context)
      Chooses the state a player places, for instance facing the player.
      Parameters:
      context - where and how the block is being placed
      Returns:
      the state to place, or null to refuse the placement
      Since:
      0.1.0
    • lightEmission

      default int lightEmission(BlockData data)
      Returns the light level the state emits, from 0 to 15.
      Parameters:
      data - the state
      Returns:
      the light level the state emits, from 0 to 15
      Since:
      0.1.0
    • lightOpacity

      default int lightOpacity(BlockData data)
      Returns how much light the state absorbs, from 0 (transparent) to 15 (opaque).
      Parameters:
      data - the state
      Returns:
      how much light the state absorbs, from 0 (transparent) to 15 (opaque)
      Since:
      0.1.0