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 successfulcanVillagerCompost- whether farmer villagers can compost the item
Data map value for compostables.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanThe field for thecanVillagerCompostrecord component.private 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) Constructs aCompostablethat cannot be composted by farmer villagers.Compostable(float chance, boolean canVillagerCompost) Creates an instance of aCompostablerecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of thecanVillagerCompostrecord component.floatchance()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. -
canVillagerCompost
private final boolean canVillagerCompostThe field for thecanVillagerCompostrecord component. -
CHANCE_CODEC
-
CODEC
-
-
Constructor Details
-
Compostable
public Compostable(float chance) Constructs aCompostablethat cannot be composted by farmer villagers.- Parameters:
chance- the chance that a compost is successful
-
Compostable
public Compostable(float chance, boolean canVillagerCompost) Creates an instance of aCompostablerecord class.- Parameters:
chance- the value for thechancerecord componentcanVillagerCompost- the value for thecanVillagerCompostrecord 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
-
canVillagerCompost
public boolean canVillagerCompost()Returns the value of thecanVillagerCompostrecord component.- Returns:
- the value of the
canVillagerCompostrecord component
-