Record Class BindingCurseEffect
java.lang.Object
java.lang.Record
johnsmith.enchantingoverhauled.api.enchantment.effect.BindingCurseEffect
- Record Components:
chance- ALevelBasedValuethat calculates the probability (0.0to1.0) that the bound armor item will be saved and kept when the player dies.
public record BindingCurseEffect(net.minecraft.world.item.enchantment.LevelBasedValue chance)
extends Record
A data-driven record defining the parameters for the Binding Curse enchantment effect component.
This effect controls the probabilistic chance that an armor item equipped with the Curse of Binding will be saved and restored to its original armor slot upon the player's death, expanding upon the vanilla behavior where the item only prevents manual removal.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<BindingCurseEffect> The codec responsible for serializing and deserializing instances of this record from JSON. -
Constructor Summary
ConstructorsConstructorDescriptionBindingCurseEffect(net.minecraft.world.item.enchantment.LevelBasedValue chance) Creates an instance of aBindingCurseEffectrecord class. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.item.enchantment.LevelBasedValuechance()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
-
CODEC
The codec responsible for serializing and deserializing instances of this record from JSON. Maps the"chance"field to aLevelBasedValue.
-
-
Constructor Details
-
BindingCurseEffect
public BindingCurseEffect(net.minecraft.world.item.enchantment.LevelBasedValue chance) Creates an instance of aBindingCurseEffectrecord 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 withObjects::equals(Object,Object). -
chance
public net.minecraft.world.item.enchantment.LevelBasedValue chance()Returns the value of thechancerecord component.- Returns:
- the value of the
chancerecord component
-