Record Class IgniteEffect
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.spellfield.effect.entity.IgniteEffect
- Record Components:
durationSeconds- TheLevelBasedValuebase burn duration in seconds before topological scaling.entityFilter- OptionalContextAwarePredicaterestricting which entities are ignited.
- All Implemented Interfaces:
SpellFieldEffect, SpellFieldEntityEffect
public record IgniteEffect(net.minecraft.world.item.enchantment.LevelBasedValue durationSeconds, Optional<net.minecraft.advancements.predicates.ContextAwarePredicate> entityFilter)
extends Record
implements SpellFieldEntityEffect
A
SpellFieldEntityEffect that sets targeted entities on fire for a configured duration
in seconds, scaled by each target's local topological multiplier.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<IgniteEffect> MapCodec for serializing and deserializingIgniteEffectinstances from JSON.static final StringJSON field key for the burn duration in seconds.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. -
Constructor Summary
ConstructorsConstructorDescriptionIgniteEffect(net.minecraft.world.item.enchantment.LevelBasedValue durationSeconds) Constructs an unfilteredIgniteEffect.IgniteEffect(net.minecraft.world.item.enchantment.LevelBasedValue durationSeconds, Optional<net.minecraft.advancements.predicates.ContextAwarePredicate> entityFilter) Creates an instance of aIgniteEffectrecord class.IgniteEffect(net.minecraft.world.item.enchantment.LevelBasedValue durationSeconds, net.minecraft.advancements.predicates.ContextAwarePredicate entityFilter) Constructs anIgniteEffectrestricted 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) Ignitesvictimfor $\text{durationSeconds} \cdot \text{volumeScalar}$ seconds viaEntity.igniteForSeconds(float)if it matchesentityFilter().com.mojang.serialization.MapCodec<? extends SpellFieldEntityEffect> codec()Retrieves theMapCodecresponsible for serializing and deserializing this effect.net.minecraft.world.item.enchantment.LevelBasedValueReturns the value of thedurationSecondsrecord component.Optional<net.minecraft.advancements.predicates.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.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
DURATION_SECONDS
JSON field key for the burn duration in seconds.- 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 deserializingIgniteEffectinstances from JSON.
-
-
Constructor Details
-
IgniteEffect
public IgniteEffect(net.minecraft.world.item.enchantment.LevelBasedValue durationSeconds) Constructs an unfilteredIgniteEffect.- Parameters:
durationSeconds- TheLevelBasedValuebase burn duration in seconds.
-
IgniteEffect
public IgniteEffect(net.minecraft.world.item.enchantment.LevelBasedValue durationSeconds, net.minecraft.advancements.predicates.ContextAwarePredicate entityFilter) Constructs anIgniteEffectrestricted by the given entity predicate filter.- Parameters:
durationSeconds- TheLevelBasedValuebase burn duration in seconds.entityFilter- The predicate filter to match against candidate entities.
-
IgniteEffect
public IgniteEffect(net.minecraft.world.item.enchantment.LevelBasedValue durationSeconds, Optional<net.minecraft.advancements.predicates.ContextAwarePredicate> entityFilter) Creates an instance of aIgniteEffectrecord class.- Parameters:
durationSeconds- the value for thedurationSecondsrecord 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) Ignitesvictimfor $\text{durationSeconds} \cdot \text{volumeScalar}$ seconds viaEntity.igniteForSeconds(float)if it matchesentityFilter().- 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). -
durationSeconds
public net.minecraft.world.item.enchantment.LevelBasedValue durationSeconds()Returns the value of thedurationSecondsrecord component.- Returns:
- the value of the
durationSecondsrecord component
-
entityFilter
Returns the value of theentityFilterrecord component.- Returns:
- the value of the
entityFilterrecord component
-