Package net.minecraft.state.property
Class EnumProperty<T extends Enum<T> & StringIdentifiable>
java.lang.Object
net.minecraft.state.property.Property<T>
net.minecraft.state.property.EnumProperty<T>
Represents a property that has enum values.
Notes on the enum class:
- The enum class is required to have 2 or more values.
- The enum class is required to provide a name for each value by
overriding
StringIdentifiable.asString(). - The names of the values are required to match the valid name pattern.
Otherwise,
IllegalArgumentExceptionwill be thrown during the validation of a property.
See Properties for example
usages.
- Mappings:
Namespace Name named net/minecraft/state/property/EnumPropertyintermediary net/minecraft/class_2754official eco
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.state.property.Property
Property.Value<T extends Comparable<T>> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintbooleanReturns all possible values of this property.Returns the name of the given value of this property.static <T extends Enum<T> & StringIdentifiable>
EnumProperty<T> Creates an enum property with all values of the given enum class.static <T extends Enum<T> & StringIdentifiable>
EnumProperty<T> Creates an enum property with the values allowed by the given filter.static <T extends Enum<T> & StringIdentifiable>
EnumProperty<T> Creates an enum property with the given values.static <T extends Enum<T> & StringIdentifiable>
EnumProperty<T> Creates an enum property with the given values.intMethods inherited from class net.minecraft.state.property.Property
createValue, createValue, getCodec, getName, getType, getValueCodec, hashCode, parse, stream, toString
-
Field Details
-
values
- Mappings:
Namespace Name Mixin selector named valuesLnet/minecraft/state/property/EnumProperty;values:Ljava/util/List;intermediary field_12595Lnet/minecraft/class_2754;field_12595:Ljava/util/List;official aLeco;a:Ljava/util/List;
-
byName
- Mappings:
Namespace Name Mixin selector named byNameLnet/minecraft/state/property/EnumProperty;byName:Ljava/util/Map;intermediary field_12596Lnet/minecraft/class_2754;field_12596:Ljava/util/Map;official bLeco;b:Ljava/util/Map;
-
enumOrdinalToPropertyOrdinal
private final int[] enumOrdinalToPropertyOrdinal- Mappings:
Namespace Name Mixin selector named enumOrdinalToPropertyOrdinalLnet/minecraft/state/property/EnumProperty;enumOrdinalToPropertyOrdinal:[Iintermediary field_54329Lnet/minecraft/class_2754;field_54329:[Iofficial cLeco;c:[I
-
-
Constructor Details
-
EnumProperty
- Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/state/property/EnumProperty;<init>(Ljava/lang/String;Ljava/lang/Class;Ljava/util/List;)Vintermediary <init>Lnet/minecraft/class_2754;<init>(Ljava/lang/String;Ljava/lang/Class;Ljava/util/List;)Vofficial <init>Leco;<init>(Ljava/lang/String;Ljava/lang/Class;Ljava/util/List;)V
-
-
Method Details
-
getValues
Returns all possible values of this property.- Specified by:
getValuesin classProperty<T extends Enum<T> & StringIdentifiable>- Mappings:
Namespace Name Mixin selector named getValuesLnet/minecraft/state/property/Property;getValues()Ljava/util/List;intermediary method_11898Lnet/minecraft/class_2769;method_11898()Ljava/util/List;official aLect;a()Ljava/util/List;
-
parse
- Specified by:
parsein classProperty<T extends Enum<T> & StringIdentifiable>- Mappings:
Namespace Name Mixin selector named parseLnet/minecraft/state/property/Property;parse(Ljava/lang/String;)Ljava/util/Optional;intermediary method_11900Lnet/minecraft/class_2769;method_11900(Ljava/lang/String;)Ljava/util/Optional;official bLect;b(Ljava/lang/String;)Ljava/util/Optional;
-
name
Description copied from class:PropertyReturns the name of the given value of this property.- Specified by:
namein classProperty<T extends Enum<T> & StringIdentifiable>- Mappings:
Namespace Name Mixin selector named nameLnet/minecraft/state/property/EnumProperty;name(Ljava/lang/Enum;)Ljava/lang/String;intermediary method_11846Lnet/minecraft/class_2754;method_11846(Ljava/lang/Enum;)Ljava/lang/String;official aLeco;a(Ljava/lang/Enum;)Ljava/lang/String;
-
ordinal
- Specified by:
ordinalin classProperty<T extends Enum<T> & StringIdentifiable>- Mappings:
Namespace Name Mixin selector named ordinalLnet/minecraft/state/property/EnumProperty;ordinal(Ljava/lang/Enum;)Iintermediary method_64221Lnet/minecraft/class_2754;method_64221(Ljava/lang/Enum;)Iofficial bLeco;b(Ljava/lang/Enum;)I
-
equals
- Overrides:
equalsin classProperty<T extends Enum<T> & StringIdentifiable>- Mappings:
Namespace Name Mixin selector named equalsLnet/minecraft/state/property/Property;equals(Ljava/lang/Object;)Zintermediary equalsLnet/minecraft/class_2769;equals(Ljava/lang/Object;)Zofficial equalsLect;equals(Ljava/lang/Object;)Z
-
computeHashCode
public int computeHashCode()- Overrides:
computeHashCodein classProperty<T extends Enum<T> & StringIdentifiable>- Mappings:
Namespace Name Mixin selector named computeHashCodeLnet/minecraft/state/property/Property;computeHashCode()Iintermediary method_11799Lnet/minecraft/class_2769;method_11799()Iofficial bLect;b()I
-
of
public static <T extends Enum<T> & StringIdentifiable> EnumProperty<T> of(String name, Class<T> type) Creates an enum property with all values of the given enum class.- Parameters:
name- the name of the property; see the note on the nametype- the type of the values the property contains- Throws:
IllegalArgumentException- if multiple values have the same name- Mappings:
Namespace Name Mixin selector named ofLnet/minecraft/state/property/EnumProperty;of(Ljava/lang/String;Ljava/lang/Class;)Lnet/minecraft/state/property/EnumProperty;intermediary method_11850Lnet/minecraft/class_2754;method_11850(Ljava/lang/String;Ljava/lang/Class;)Lnet/minecraft/class_2754;official aLeco;a(Ljava/lang/String;Ljava/lang/Class;)Leco;
-
of
public static <T extends Enum<T> & StringIdentifiable> EnumProperty<T> of(String name, Class<T> type, Predicate<T> filter) Creates an enum property with the values allowed by the given filter.- Parameters:
name- the name of the property; see the note on the nametype- the type of the values the property containsfilter- the filter which specifies if a value is allowed; required to allow 2 or more values- Throws:
IllegalArgumentException- if multiple values have the same name- See Also:
- Mappings:
Namespace Name Mixin selector named ofLnet/minecraft/state/property/EnumProperty;of(Ljava/lang/String;Ljava/lang/Class;Ljava/util/function/Predicate;)Lnet/minecraft/state/property/EnumProperty;intermediary method_11848Lnet/minecraft/class_2754;method_11848(Ljava/lang/String;Ljava/lang/Class;Ljava/util/function/Predicate;)Lnet/minecraft/class_2754;official aLeco;a(Ljava/lang/String;Ljava/lang/Class;Ljava/util/function/Predicate;)Leco;
-
of
@SafeVarargs public static <T extends Enum<T> & StringIdentifiable> EnumProperty<T> of(String name, Class<T> type, T[] values) Creates an enum property with the given values.- Parameters:
name- the name of the property; see the note on the nametype- the type of the values the property containsvalues- the values the property contains; required to have 2 or more values- Throws:
IllegalArgumentException- if multiple values have the same name- See Also:
- Mappings:
Namespace Name Mixin selector named ofLnet/minecraft/state/property/EnumProperty;of(Ljava/lang/String;Ljava/lang/Class;[Ljava/lang/Enum;)Lnet/minecraft/state/property/EnumProperty;intermediary method_11849Lnet/minecraft/class_2754;method_11849(Ljava/lang/String;Ljava/lang/Class;[Ljava/lang/Enum;)Lnet/minecraft/class_2754;official aLeco;a(Ljava/lang/String;Ljava/lang/Class;[Ljava/lang/Enum;)Leco;
-
of
public static <T extends Enum<T> & StringIdentifiable> EnumProperty<T> of(String name, Class<T> type, List<T> values) Creates an enum property with the given values.- Parameters:
name- the name of the property; see the note on the nametype- the type of the values the property contains- Throws:
IllegalArgumentException- if multiple values have the same name- See Also:
- Mappings:
Namespace Name Mixin selector named ofLnet/minecraft/state/property/EnumProperty;of(Ljava/lang/String;Ljava/lang/Class;Ljava/util/List;)Lnet/minecraft/state/property/EnumProperty;intermediary method_11847Lnet/minecraft/class_2754;method_11847(Ljava/lang/String;Ljava/lang/Class;Ljava/util/List;)Lnet/minecraft/class_2754;official aLeco;a(Ljava/lang/String;Ljava/lang/Class;Ljava/util/List;)Leco;
-