Package net.minecraft.state
Class StateHolder<O,S>
- java.lang.Object
-
- net.minecraft.state.StateHolder<O,S>
-
- Direct Known Subclasses:
AbstractBlock.AbstractBlockState
,FluidState
public abstract class StateHolder<O,S> extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private com.google.common.collect.Table<Property<?>,java.lang.Comparable<?>,S>
neighbours
protected O
owner
protected com.mojang.serialization.MapCodec<S>
propertiesCodec
private static java.util.function.Function<java.util.Map.Entry<Property<?>,java.lang.Comparable<?>>,java.lang.String>
PROPERTY_ENTRY_TO_STRING_FUNCTION
private com.google.common.collect.ImmutableMap<Property<?>,java.lang.Comparable<?>>
values
-
Constructor Summary
Constructors Modifier Constructor Description protected
StateHolder(O p_i231879_1_, com.google.common.collect.ImmutableMap<Property<?>,java.lang.Comparable<?>> p_i231879_2_, com.mojang.serialization.MapCodec<S> p_i231879_3_)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static <O,S extends StateHolder<O,S>>
com.mojang.serialization.Codec<S>codec(com.mojang.serialization.Codec<O> p_235897_0_, java.util.function.Function<O,S> p_235897_1_)
<T extends java.lang.Comparable<T>>
Scycle(Property<T> p_235896_1_)
protected static <T> T
findNextInCollection(java.util.Collection<T> p_235898_0_, T p_235898_1_)
<T extends java.lang.Comparable<T>>
java.util.Optional<T>getOptionalValue(Property<T> p_235903_1_)
java.util.Collection<Property<?>>
getProperties()
<T extends java.lang.Comparable<T>>
TgetValue(Property<T> p_177229_1_)
com.google.common.collect.ImmutableMap<Property<?>,java.lang.Comparable<?>>
getValues()
<T extends java.lang.Comparable<T>>
booleanhasProperty(Property<T> p_235901_1_)
private java.util.Map<Property<?>,java.lang.Comparable<?>>
makeNeighbourValues(Property<?> p_235902_1_, java.lang.Comparable<?> p_235902_2_)
void
populateNeighbours(java.util.Map<java.util.Map<Property<?>,java.lang.Comparable<?>>,S> p_235899_1_)
<T extends java.lang.Comparable<T>,V extends T>
SsetValue(Property<T> p_206870_1_, V p_206870_2_)
java.lang.String
toString()
-
-
-
Field Detail
-
PROPERTY_ENTRY_TO_STRING_FUNCTION
private static final java.util.function.Function<java.util.Map.Entry<Property<?>,java.lang.Comparable<?>>,java.lang.String> PROPERTY_ENTRY_TO_STRING_FUNCTION
-
owner
protected final O owner
-
values
private final com.google.common.collect.ImmutableMap<Property<?>,java.lang.Comparable<?>> values
-
neighbours
private com.google.common.collect.Table<Property<?>,java.lang.Comparable<?>,S> neighbours
-
propertiesCodec
protected final com.mojang.serialization.MapCodec<S> propertiesCodec
-
-
Method Detail
-
findNextInCollection
protected static <T> T findNextInCollection(java.util.Collection<T> p_235898_0_, T p_235898_1_)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getProperties
public java.util.Collection<Property<?>> getProperties()
-
hasProperty
public <T extends java.lang.Comparable<T>> boolean hasProperty(Property<T> p_235901_1_)
-
getValue
public <T extends java.lang.Comparable<T>> T getValue(Property<T> p_177229_1_)
-
getOptionalValue
public <T extends java.lang.Comparable<T>> java.util.Optional<T> getOptionalValue(Property<T> p_235903_1_)
-
setValue
public <T extends java.lang.Comparable<T>,V extends T> S setValue(Property<T> p_206870_1_, V p_206870_2_)
-
populateNeighbours
public void populateNeighbours(java.util.Map<java.util.Map<Property<?>,java.lang.Comparable<?>>,S> p_235899_1_)
-
makeNeighbourValues
private java.util.Map<Property<?>,java.lang.Comparable<?>> makeNeighbourValues(Property<?> p_235902_1_, java.lang.Comparable<?> p_235902_2_)
-
getValues
public com.google.common.collect.ImmutableMap<Property<?>,java.lang.Comparable<?>> getValues()
-
codec
protected static <O,S extends StateHolder<O,S>> com.mojang.serialization.Codec<S> codec(com.mojang.serialization.Codec<O> p_235897_0_, java.util.function.Function<O,S> p_235897_1_)
-
-