Class StateHolder<O,S>

java.lang.Object
net.minecraft.world.level.block.state.StateHolder<O,S>
Direct Known Subclasses:
BlockBehaviour.BlockStateBase, FluidState

public abstract class StateHolder<O,S> extends Object
  • Field Details

  • Constructor Details

    • StateHolder

      protected StateHolder(O p_61117_, it.unimi.dsi.fastutil.objects.Reference2ObjectArrayMap<Property<?>,Comparable<?>> p_326342_, com.mojang.serialization.MapCodec<S> p_61119_)
  • Method Details

    • cycle

      public <T extends Comparable<T>> S cycle(Property<T> pProperty)
    • findNextInCollection

      protected static <T> T findNextInCollection(List<T> pPossibleValues, T pCurrentValue)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public final boolean equals(Object pOther)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getProperties

      public Collection<Property<?>> getProperties()
    • hasProperty

      public boolean hasProperty(Property<?> pProperty)
    • getValue

      public <T extends Comparable<T>> T getValue(Property<T> pProperty)
      Returns:
      the value of the given Property for this state
    • getOptionalValue

      public <T extends Comparable<T>> Optional<T> getOptionalValue(Property<T> pProperty)
    • getValueOrElse

      public <T extends Comparable<T>> T getValueOrElse(Property<T> pProperty, T pDefaultValue)
    • getNullableValue

      @Nullable private <T extends Comparable<T>> T getNullableValue(Property<T> pProperty)
    • setValue

      public <T extends Comparable<T>, V extends T> S setValue(Property<T> pProperty, V pValue)
    • trySetValue

      public <T extends Comparable<T>, V extends T> S trySetValue(Property<T> pProperty, V pValue)
    • setValueInternal

      private <T extends Comparable<T>, V extends T> S setValueInternal(Property<T> pProperty, V pValue, Comparable<?> pComparable)
    • populateNeighbours

      public void populateNeighbours(Map<Map<Property<?>,Comparable<?>>,S> pPossibleStateMap)
    • makeNeighbourValues

      private Map<Property<?>,Comparable<?>> makeNeighbourValues(Property<?> pProperty, Comparable<?> pValue)
    • getValues

      public Map<Property<?>,Comparable<?>> getValues()
    • codec

      protected static <O, S extends StateHolder<O, S>> com.mojang.serialization.Codec<S> codec(com.mojang.serialization.Codec<O> p_61128_, Function<O,S> p_61129_)