Document property classes (#2375)

* Document property classes

* Merge two throws clauses

* Remove time complexity

* Use linkplain tag for the valid name pattern

Co-Authored-By: liach <7806504+liach@users.noreply.github.com>

* can take -> has

Co-Authored-By: liach <7806504+liach@users.noreply.github.com>

* can take -> contains

* Move notes on the enum class to the class javadoc

* Apply suggestions from code review

Co-authored-by: liach <7806504+liach@users.noreply.github.com>

* Document the exception thrown when the name is invalid

* can take -> contains

Co-authored-by: liach <7806504+liach@users.noreply.github.com>
This commit is contained in:
enbrain 2021-05-05 20:52:32 +09:00 committed by GitHub
parent a30bafcec5
commit 219575789e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 114 additions and 26 deletions

View File

@ -1,6 +1,13 @@
CLASS net/minecraft/class_2746 net/minecraft/state/property/BooleanProperty
COMMENT Represents a property that has boolean values.
COMMENT
COMMENT <p>See {@link net.minecraft.state.property.Properties} for example
COMMENT usages.
FIELD field_12575 values Lcom/google/common/collect/ImmutableSet;
METHOD <init> (Ljava/lang/String;)V
ARG 1 name
METHOD method_11825 of (Ljava/lang/String;)Lnet/minecraft/class_2746;
COMMENT Creates a boolean property.
ARG 0 name
COMMENT the name of the property; see {@linkplain Property#name the note on the
COMMENT name}

View File

@ -1,24 +1,42 @@
CLASS net/minecraft/class_2753 net/minecraft/state/property/DirectionProperty
COMMENT Represents a property that has direction values.
COMMENT
COMMENT <p>See {@link net.minecraft.state.property.Properties} for example
COMMENT usages.
METHOD <init> (Ljava/lang/String;Ljava/util/Collection;)V
ARG 1 name
ARG 2 values
METHOD method_11843 of (Ljava/lang/String;Ljava/util/Collection;)Lnet/minecraft/class_2753;
COMMENT Creates a direction property which only supports specific values
COMMENT Creates a direction property with the given values.
COMMENT
COMMENT @see #of(String)
ARG 0 name
COMMENT the name of this property
COMMENT the name of the property; see {@linkplain Property#name the note on the
COMMENT name}
ARG 1 values
COMMENT the values this property can have
COMMENT the values the property contains; required to have 2 or more values
METHOD method_11844 of (Ljava/lang/String;Ljava/util/function/Predicate;)Lnet/minecraft/class_2753;
COMMENT Creates a direction property.
COMMENT Creates a direction property with the values allowed by the given
COMMENT filter out of all 6 directions.
COMMENT
COMMENT @see #of(String)
ARG 0 name
COMMENT the name of this property
COMMENT the name of the property; see {@linkplain Property#name the note on the
COMMENT name}
ARG 1 filter
COMMENT a filter which specifies if a value is allowed
COMMENT the filter which specifies if a value is allowed; required to allow
COMMENT 2 or more values
METHOD method_11845 of (Ljava/lang/String;[Lnet/minecraft/class_2350;)Lnet/minecraft/class_2753;
COMMENT Creates a direction property which only supports specific values
COMMENT Creates a direction property with the given values.
COMMENT
COMMENT @see #of(String)
ARG 0 name
COMMENT the name of this property
COMMENT the name of the property; see {@linkplain Property#name the note on the
COMMENT name}
ARG 1 values
COMMENT the values this property can have
COMMENT the values the property contains; required to have 2 or more values
METHOD method_35305 of (Ljava/lang/String;)Lnet/minecraft/class_2753;
COMMENT Creates a direction property with all directions as values.
ARG 0 name
COMMENT the name of the property; see {@linkplain Property#name the note on the
COMMENT name}

View File

@ -1,4 +1,20 @@
CLASS net/minecraft/class_2754 net/minecraft/state/property/EnumProperty
COMMENT Represents a property that has enum values.
COMMENT
COMMENT <p id="notes-on-enum">Notes on the enum class:
COMMENT <ul>
COMMENT <li>The enum class is required to have 2 or more values.
COMMENT <li>The enum class is required to provide a name for each value by
COMMENT overriding {@link StringIdentifiable#asString()}.
COMMENT <li>The names of the values are required to match the {@linkplain
COMMENT net.minecraft.state.StateManager#VALID_NAME_PATTERN valid name pattern}.
COMMENT Otherwise, {@link IllegalArgumentException} will be thrown during the
COMMENT {@linkplain net.minecraft.state.StateManager.Builder#validate(Property)
COMMENT validation of a property}.
COMMENT </ul>
COMMENT
COMMENT <p>See {@link net.minecraft.state.property.Properties} for example
COMMENT usages.
FIELD field_12595 values Lcom/google/common/collect/ImmutableSet;
FIELD field_12596 byName Ljava/util/Map;
METHOD <init> (Ljava/lang/String;Ljava/lang/Class;Ljava/util/Collection;)V
@ -6,28 +22,59 @@ CLASS net/minecraft/class_2754 net/minecraft/state/property/EnumProperty
ARG 2 type
ARG 3 values
METHOD method_11847 of (Ljava/lang/String;Ljava/lang/Class;Ljava/util/Collection;)Lnet/minecraft/class_2754;
COMMENT Creates an enum property.
COMMENT Creates an enum property with the given values.
COMMENT
COMMENT <p>See <a href="#notes-on-enum">notes on the enum class</a>.
COMMENT
COMMENT @throws IllegalArgumentException if multiple values have the same name
COMMENT
COMMENT @see #of(String, Class)
ARG 0 name
COMMENT the name of this property
COMMENT the name of the property; see {@linkplain Property#name the note on the
COMMENT name}
ARG 1 type
COMMENT the type this property contains
COMMENT the type of the values the property contains
ARG 2 values
COMMENT the values this property could contain
COMMENT the values the property contains; required to have 2 or more values
METHOD method_11848 of (Ljava/lang/String;Ljava/lang/Class;Ljava/util/function/Predicate;)Lnet/minecraft/class_2754;
COMMENT Creates an enum property.
COMMENT Creates an enum property with the values allowed by the given filter.
COMMENT
COMMENT <p>See <a href="#notes-on-enum">notes on the enum class</a>.
COMMENT
COMMENT @throws IllegalArgumentException if multiple values have the same name
COMMENT
COMMENT @see #of(String, Class)
ARG 0 name
COMMENT the name of this property
COMMENT the name of the property; see {@linkplain Property#name the note on the
COMMENT name}
ARG 1 type
COMMENT the type this property contains
COMMENT the type of the values the property contains
ARG 2 filter
COMMENT a filter that specifies if a value is allowed
COMMENT the filter which specifies if a value is allowed; required to allow 2
COMMENT or more values
METHOD method_11849 of (Ljava/lang/String;Ljava/lang/Class;[Ljava/lang/Enum;)Lnet/minecraft/class_2754;
COMMENT Creates an enum property with the given values.
COMMENT
COMMENT <p>See <a href="#notes-on-enum">notes on the enum class</a>.
COMMENT
COMMENT @throws IllegalArgumentException if multiple values have the same name
COMMENT
COMMENT @see #of(String, Class)
ARG 0 name
COMMENT the name of the property; see {@linkplain Property#name the note on the
COMMENT name}
ARG 1 type
COMMENT the type of the values the property contains
ARG 2 values
COMMENT the values the property contains; required to have 2 or more values
METHOD method_11850 of (Ljava/lang/String;Ljava/lang/Class;)Lnet/minecraft/class_2754;
COMMENT Creates an enum property.
COMMENT Creates an enum property with all values of the given enum class.
COMMENT
COMMENT <p>See <a href="#notes-on-enum">notes on the enum class</a>.
COMMENT
COMMENT @throws IllegalArgumentException if multiple values have the same name
ARG 0 name
COMMENT the name of this property
COMMENT the name of the property; see {@linkplain Property#name the note on the
COMMENT name}
ARG 1 type
COMMENT the type this property contains
COMMENT the type of the values the property contains

View File

@ -1,4 +1,8 @@
CLASS net/minecraft/class_2758 net/minecraft/state/property/IntProperty
COMMENT Represents a property that has integer values.
COMMENT
COMMENT <p>See {@link net.minecraft.state.property.Properties} for example
COMMENT usages.
FIELD field_12614 values Lcom/google/common/collect/ImmutableSet;
METHOD <init> (Ljava/lang/String;II)V
ARG 1 name
@ -7,12 +11,14 @@ CLASS net/minecraft/class_2758 net/minecraft/state/property/IntProperty
METHOD method_11867 of (Ljava/lang/String;II)Lnet/minecraft/class_2758;
COMMENT Creates an integer property.
COMMENT
COMMENT <p>{@code min} must be non-negative and {@code max} must be greater than {@code min}.
COMMENT <p>Note that this method computes all possible values.
COMMENT
COMMENT <p>Note that this method takes O({@code max} - {@code min}) time as it computes all possible values during instantiation.
COMMENT @throws IllegalArgumentException if {@code 0 <= min < max} is not
COMMENT satisfied
ARG 0 name
COMMENT the name of the property
COMMENT the name of the property; see {@linkplain Property#name the note on the
COMMENT name}
ARG 1 min
COMMENT the minimum value the property can take
COMMENT the minimum value the property contains
ARG 2 max
COMMENT the maximum value the property can take
COMMENT the maximum value the property contains

View File

@ -1,6 +1,13 @@
CLASS net/minecraft/class_2769 net/minecraft/state/property/Property
FIELD field_24742 type Ljava/lang/Class;
FIELD field_24743 name Ljava/lang/String;
COMMENT The name of this property.
COMMENT
COMMENT <p>Note that the name is required to match the {@linkplain
COMMENT net.minecraft.state.StateManager#VALID_NAME_PATTERN valid name pattern}.
COMMENT Otherwise, {@link IllegalArgumentException} will be thrown during the
COMMENT {@linkplain net.minecraft.state.StateManager.Builder#validate(Property)
COMMENT validation of a property}.
FIELD field_24744 hashCodeCache Ljava/lang/Integer;
FIELD field_24745 codec Lcom/mojang/serialization/Codec;
FIELD field_25670 valueCodec Lcom/mojang/serialization/Codec;
@ -11,13 +18,16 @@ CLASS net/minecraft/class_2769 net/minecraft/state/property/Property
ARG 1 o
METHOD method_11799 computeHashCode ()I
METHOD method_11898 getValues ()Ljava/util/Collection;
COMMENT Returns all possible values the property can take.
COMMENT Returns all possible values of this property.
METHOD method_11899 getName ()Ljava/lang/String;
COMMENT Returns the name of this property.
METHOD method_11900 parse (Ljava/lang/String;)Ljava/util/Optional;
ARG 1 name
METHOD method_11901 name (Ljava/lang/Comparable;)Ljava/lang/String;
COMMENT Returns the name of the given value of this property.
ARG 1 value
METHOD method_11902 getType ()Ljava/lang/Class;
COMMENT Returns the type of the values of this property.
METHOD method_28504 (Ljava/lang/String;)Lcom/mojang/serialization/DataResult;
ARG 1 value
METHOD method_30041 createValue (Lnet/minecraft/class_2688;)Lnet/minecraft/class_2769$class_4933;