Record Class SetFireDurationEffect
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.effect.SetFireDurationEffect
- Record Components:
duration- TheLevelBasedValuespecifying the fire duration in seconds.
- All Implemented Interfaces:
net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect, net.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect
public record SetFireDurationEffect(net.minecraft.world.item.enchantment.LevelBasedValue duration)
extends Record
implements net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect
An
EnchantmentEntityEffect that assigns a custom burn duration (in seconds) to an entity
implementing FireDurationAccessor.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<SetFireDurationEffect> MapCodec for serializing and deserializingSetFireDurationEffectinstances from JSON.static final StringJSON field key for the fire duration in seconds.static final StringRegistry path identifier for this entity effect.static final LevelBasedKeyProviderSupplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation. -
Constructor Summary
ConstructorsConstructorDescriptionSetFireDurationEffect(net.minecraft.world.item.enchantment.LevelBasedValue duration) Creates an instance of aSetFireDurationEffectrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(net.minecraft.server.level.ServerLevel level, int enchantmentLevel, net.minecraft.world.item.enchantment.EnchantedItemInUse context, net.minecraft.world.entity.Entity entity, net.minecraft.world.phys.Vec3 origin) Assigns the evaluated fire duration in seconds toentityif it implementsFireDurationAccessor.com.mojang.serialization.MapCodec<? extends net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect> codec()net.minecraft.world.item.enchantment.LevelBasedValueduration()Returns the value of thedurationrecord 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.Methods inherited from interface net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect
onChangedBlockMethods inherited from interface net.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect
onDeactivated
-
Field Details
-
DURATION
-
KEY
-
KEY_PROVIDER
Supplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation. -
CODEC
MapCodec for serializing and deserializingSetFireDurationEffectinstances from JSON.
-
-
Constructor Details
-
SetFireDurationEffect
public SetFireDurationEffect(net.minecraft.world.item.enchantment.LevelBasedValue duration) Creates an instance of aSetFireDurationEffectrecord class.- Parameters:
duration- the value for thedurationrecord component
-
-
Method Details
-
apply
public void apply(net.minecraft.server.level.ServerLevel level, int enchantmentLevel, net.minecraft.world.item.enchantment.EnchantedItemInUse context, net.minecraft.world.entity.Entity entity, net.minecraft.world.phys.Vec3 origin) Assigns the evaluated fire duration in seconds toentityif it implementsFireDurationAccessor.- Specified by:
applyin interfacenet.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect- Parameters:
level- The server level in which the effect is triggered.enchantmentLevel- The level of the source enchantment.context- The context of the enchanted item in use.entity- The target entity receiving the fire duration state.origin- The origin position vector of the trigger.
-
codec
public com.mojang.serialization.MapCodec<? extends net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect> codec()- Specified by:
codecin interfacenet.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect- Specified by:
codecin interfacenet.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect
-
toString
-
hashCode
-
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). -
duration
-