Annotation Interface BlockTrait


@Documented @Retention(RUNTIME) @Target(TYPE) public @interface BlockTrait
Declares which block types a trait interface of fr.fidorial.world.block.data applies to, from the properties they declare.

A block type implements a trait when it declares every property of properties(), the values of each property satisfy values(), and it also satisfies the BlockTrait of every trait the interface extends. For instance Stairs extends Directional, Bisected, Waterlogged only asks for shape: the facing, half and waterlogged requirements come from its parents.

Detection never looks at the block key, so a new block sharing the properties of a trait gets it for free. The traits of the API are indexed at compile time by an annotation processor, so a new trait is one annotated public interface extending BlockData, with no list to update. Plugins compile without that processor: their own traits are added to their blocks with BlockType.Builder.trait(Class).

Since:
0.1.0
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static @interface 
    Restricts the values a property may declare.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Returns the names of the properties a block type must declare; empty when only the parent traits matter.
    Returns restrictions on the values of the declared properties.
  • Element Details

    • properties

      String[] properties
      Returns the names of the properties a block type must declare; empty when only the parent traits matter.
      Returns:
      the names of the properties a block type must declare; empty when only the parent traits matter
      Since:
      0.1.0
      Default:
      {}
    • values

      Returns restrictions on the values of the declared properties.
      Returns:
      restrictions on the values of the declared properties
      Since:
      0.1.0
      Default:
      {}