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
FieldsModifier and TypeFieldDescriptionprivate final floatThe field for thechancerecord component.static final com.mojang.serialization.Codec<Compostable> static final com.mojang.serialization.Codec<Compostable> -
Constructor Summary
ConstructorsConstructorDescriptionCompostable(float chance) Creates an instance of aCompostablerecord class. -
Method Summary
Modifier and TypeMethodDescriptionfloatchance()Returns the value of thechancerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
chance
private final float chanceThe field for thechancerecord component. -
CHANCE_CODEC
-
CODEC
-
-
Constructor Details
-
Compostable
public Compostable(float chance) Creates an instance of aCompostablerecord class.- Parameters:
chance- the value for thechancerecord 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 thechancerecord component.- Returns:
- the value of the
chancerecord component
-