Class StateHolder<O,S>
java.lang.Object
net.minecraft.world.level.block.state.StateHolder<O,S>
- Direct Known Subclasses:
BlockBehaviour.BlockStateBase,FluidState
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected final Ostatic final Stringprotected final com.mojang.serialization.MapCodec<S> private static final Function<Map.Entry<Property<?>, Comparable<?>>, String> private final it.unimi.dsi.fastutil.objects.Reference2ObjectArrayMap<Property<?>, Comparable<?>> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedStateHolder(O pOwner, it.unimi.dsi.fastutil.objects.Reference2ObjectArrayMap<Property<?>, Comparable<?>> pValues, com.mojang.serialization.MapCodec<S> pPropertiesCodec) -
Method Summary
Modifier and TypeMethodDescriptionprotected static <O,S extends StateHolder<O, S>>
com.mojang.serialization.Codec<S> <T extends Comparable<T>>
Sfinal booleanprotected static <T> TfindNextInCollection(List<T> pPossibleValues, T pCurrentValue) private <T extends Comparable<T>>
TgetNullableValue(Property<T> pProperty) <T extends Comparable<T>>
Optional<T> getOptionalValue(Property<T> pProperty) Collection<Property<?>> <T extends Comparable<T>>
T<T extends Comparable<T>>
TgetValueOrElse(Property<T> pProperty, T pDefaultValue) Map<Property<?>, Comparable<?>> inthashCode()booleanhasProperty(Property<?> pProperty) private Map<Property<?>, Comparable<?>> makeNeighbourValues(Property<?> pProperty, Comparable<?> pValue) voidpopulateNeighbours(Map<Map<Property<?>, Comparable<?>>, S> pPossibleStateMap) <T extends Comparable<T>,V extends T>
Sprivate <T extends Comparable<T>,V extends T>
SsetValueInternal(Property<T> pProperty, V pValue, Comparable<?> pComparable) toString()<T extends Comparable<T>,V extends T>
StrySetValue(Property<T> pProperty, V pValue)
-
Field Details
-
NAME_TAG
- See Also:
-
PROPERTIES_TAG
- See Also:
-
PROPERTY_ENTRY_TO_STRING_FUNCTION
private static final Function<Map.Entry<Property<?>,Comparable<?>>, PROPERTY_ENTRY_TO_STRING_FUNCTIONString> -
owner
-
values
private final it.unimi.dsi.fastutil.objects.Reference2ObjectArrayMap<Property<?>,Comparable<?>> values -
neighbours
-
propertiesCodec
-
-
Constructor Details
-
StateHolder
protected StateHolder(O pOwner, it.unimi.dsi.fastutil.objects.Reference2ObjectArrayMap<Property<?>, Comparable<?>> pValues, com.mojang.serialization.MapCodec<S> pPropertiesCodec)
-
-
Method Details
-
cycle
-
findNextInCollection
-
toString
-
equals
-
hashCode
public int hashCode() -
getProperties
-
hasProperty
-
getValue
- Returns:
- the value of the given Property for this state
-
getOptionalValue
-
getValueOrElse
-
getNullableValue
-
setValue
-
trySetValue
-
setValueInternal
private <T extends Comparable<T>,V extends T> S setValueInternal(Property<T> pProperty, V pValue, Comparable<?> pComparable) -
populateNeighbours
-
makeNeighbourValues
private Map<Property<?>,Comparable<?>> makeNeighbourValues(Property<?> pProperty, Comparable<?> pValue) -
getValues
-
codec
protected static <O,S extends StateHolder<O, com.mojang.serialization.Codec<S> codecS>> (com.mojang.serialization.Codec<O> pOwnerCodec, Function<O, S> pDefaultStateGetter)
-