Interface Property<T>

All Known Implementing Classes:
AbstractProperty, BooleanProperty, DirectionalProperty, EnumProperty, IntegerProperty

public interface Property<T>
Describes a state property of a block.

Example states include "variant" (indicating material or type) and "facing" (indicating orientation).

  • Method Details

    • getName

      String getName()
      Returns the name of this state.
      Returns:
      The state name
    • getValues

      List<T> getValues()
      Return a list of available values for this state.
      Returns:
      the list of state values
    • getValueFor

      @Nullable T getValueFor(String string) throws IllegalArgumentException
      Gets the value for the given string, or null.
      Parameters:
      string - The string
      Returns:
      The value, or null
      Throws:
      IllegalArgumentException - When the value is invalid.
    • getIndex

      default int getIndex(T value)
      Get the index of the given value in the list of values
      Parameters:
      value - value to get index for
      Throws:
      IllegalArgumentException - if value not applicable to this property
    • getIndexFor

      default int getIndexFor(CharSequence value) throws IllegalArgumentException
      Get the index of the given value in the list of values
      Parameters:
      value - value to get index for
      Throws:
      IllegalArgumentException - if value not applicable to this property
    • getKey

      default PropertyKey getKey()
      Get the PropertyKey associated with this property.
    • getRemap

      default PropertyRemap<T> getRemap(Object from, Object to)
      Get a PropertyRemap instance for this property with the given remap.
      Parameters:
      from - value to remap from
      to - value to remap to
      Returns:
      new PropertyRemap instance