Record Class Compostable
java.lang.Object
java.lang.Record
net.neoforged.neoforge.registries.datamaps.builtin.Compostable
- Record Components:
chance
- the chance that a compost is successful
Data map value for compostables.
-
Field Summary
Modifier and TypeFieldDescriptionprivate final float
The field for thechance
record component.static final com.mojang.serialization.Codec
<Compostable> static final com.mojang.serialization.Codec
<Compostable> -
Constructor Summary
ConstructorDescriptionCompostable
(float chance) Creates an instance of aCompostable
record class. -
Method Summary
Modifier and TypeMethodDescriptionfloat
chance()
Returns the value of thechance
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
chance
private final float chanceThe field for thechance
record component. -
CHANCE_CODEC
-
CODEC
-
-
Constructor Details
-
Compostable
public Compostable(float chance) Creates an instance of aCompostable
record class.- Parameters:
chance
- the value for thechance
record component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
chance
public float chance()Returns the value of thechance
record component.- Returns:
- the value of the
chance
record component
-