Record Class ExtinguishEffect
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.spellfield.effect.entity.ExtinguishEffect
- Record Components:
tickReduction- TheLevelBasedValuenumber of fire ticks subtracted before topological scaling.entityFilter- OptionalContextAwarePredicaterestricting which entities are extinguished.
- All Implemented Interfaces:
SpellFieldEffect, SpellFieldEntityEffect
public record ExtinguishEffect(net.minecraft.world.item.enchantment.LevelBasedValue tickReduction, Optional<net.minecraft.advancements.criterion.ContextAwarePredicate> entityFilter)
extends Record
implements SpellFieldEntityEffect
A
SpellFieldEntityEffect that reduces the remaining burn duration (Entity.getRemainingFireTicks())
of burning entities within a spell field volume, scaled by each target's local topological multiplier.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<ExtinguishEffect> MapCodec for serializing and deserializingExtinguishEffectinstances from JSON.static final StringJSON field key for the optional entity filter predicate.static final StringRegistry path identifier for this spell field entity effect.static final LevelBasedKeyProviderSupplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation.static final StringJSON field key for the fire tick reduction amount. -
Constructor Summary
ConstructorsConstructorDescriptionExtinguishEffect(net.minecraft.world.item.enchantment.LevelBasedValue tickReduction) Constructs an unfilteredExtinguishEffect.ExtinguishEffect(net.minecraft.world.item.enchantment.LevelBasedValue tickReduction, Optional<net.minecraft.advancements.criterion.ContextAwarePredicate> entityFilter) Creates an instance of aExtinguishEffectrecord class.ExtinguishEffect(net.minecraft.world.item.enchantment.LevelBasedValue tickReduction, net.minecraft.advancements.criterion.ContextAwarePredicate entityFilter) Constructs anExtinguishEffectrestricted by the given entity predicate filter. -
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 spatialReference, net.minecraft.world.phys.Vec3 epicenter, net.minecraft.world.entity.Entity victim, float volumeScalar) Subtracts $\text{tickReduction} \cdot \text{volumeScalar}$ fromvictim's remaining fire ticks (clamped to a minimum of0) if the entity is currently burning.com.mojang.serialization.MapCodec<? extends SpellFieldEntityEffect> codec()Retrieves theMapCodecresponsible for serializing and deserializing this effect.Optional<net.minecraft.advancements.criterion.ContextAwarePredicate> Returns the value of theentityFilterrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.net.minecraft.world.item.enchantment.LevelBasedValueReturns the value of thetickReductionrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
TICK_REDUCTION
JSON field key for the fire tick reduction amount.- See Also:
-
ENTITY_FILTER
JSON field key for the optional entity filter predicate.- See Also:
-
KEY
Registry path identifier for this spell field entity effect.- See Also:
-
KEY_PROVIDER
Supplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation. -
CODEC
MapCodec for serializing and deserializingExtinguishEffectinstances from JSON.
-
-
Constructor Details
-
ExtinguishEffect
public ExtinguishEffect(net.minecraft.world.item.enchantment.LevelBasedValue tickReduction) Constructs an unfilteredExtinguishEffect.- Parameters:
tickReduction- TheLevelBasedValuefire tick reduction amount.
-
ExtinguishEffect
public ExtinguishEffect(net.minecraft.world.item.enchantment.LevelBasedValue tickReduction, net.minecraft.advancements.criterion.ContextAwarePredicate entityFilter) Constructs anExtinguishEffectrestricted by the given entity predicate filter.- Parameters:
tickReduction- TheLevelBasedValuefire tick reduction amount.entityFilter- The predicate filter to match against candidate entities.
-
ExtinguishEffect
public ExtinguishEffect(net.minecraft.world.item.enchantment.LevelBasedValue tickReduction, Optional<net.minecraft.advancements.criterion.ContextAwarePredicate> entityFilter) Creates an instance of aExtinguishEffectrecord class.- Parameters:
tickReduction- the value for thetickReductionrecord componententityFilter- the value for theentityFilterrecord 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 spatialReference, net.minecraft.world.phys.Vec3 epicenter, net.minecraft.world.entity.Entity victim, float volumeScalar) Subtracts $\text{tickReduction} \cdot \text{volumeScalar}$ fromvictim's remaining fire ticks (clamped to a minimum of0) if the entity is currently burning.- Specified by:
applyin interfaceSpellFieldEntityEffect- Parameters:
level- The executing server level.enchantmentLevel- The active level of the spell field enchantment.context- The item usage context triggering the spell field.spatialReference- The anchor entity or focal point of the spell field.epicenter- The exact spatial origin vector of the spell field.victim- The target entity intersecting the spell field.volumeScalar- The active topological multiplier forvictim.
-
codec
Description copied from interface:SpellFieldEffectRetrieves theMapCodecresponsible for serializing and deserializing this effect.- Specified by:
codecin interfaceSpellFieldEffect- Returns:
- The registered
MapCodecinstance.
-
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). -
tickReduction
public net.minecraft.world.item.enchantment.LevelBasedValue tickReduction()Returns the value of thetickReductionrecord component.- Returns:
- the value of the
tickReductionrecord component
-
entityFilter
Returns the value of theentityFilterrecord component.- Returns:
- the value of the
entityFilterrecord component
-