Record Class VanishingCurseEffect
java.lang.Object
java.lang.Record
johnsmith.enchantingoverhauled.api.enchantment.effect.VanishingCurseEffect
- Record Components:
chance- ALevelBasedValuethat calculates the probability (0.0to1.0) that the cursed item will vanish when the player dies.
public record VanishingCurseEffect(net.minecraft.world.item.enchantment.LevelBasedValue chance)
extends Record
A data-driven record defining the parameters for the Vanishing Curse enchantment effect component.
This effect introduces a probabilistic chance that an item cursed with Vanishing will vanish and be destroyed upon the player's death, overriding the vanilla behavior where the item is guaranteed to be destroyed 100% of the time.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<VanishingCurseEffect> The codec responsible for serializing and deserializing instances of this record from JSON. -
Constructor Summary
ConstructorsConstructorDescriptionVanishingCurseEffect(net.minecraft.world.item.enchantment.LevelBasedValue chance) Creates an instance of aVanishingCurseEffectrecord 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 single"chance"field to aLevelBasedValue.
-
-
Constructor Details
-
VanishingCurseEffect
public VanishingCurseEffect(net.minecraft.world.item.enchantment.LevelBasedValue chance) Creates an instance of aVanishingCurseEffectrecord 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
-