Record Class ExplodeEffect
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.spellfield.effect.volume.ExplodeEffect
- Record Components:
explosion- TheExplosionDefinitiongoverning radius, block interaction, fire, and particles.count- TheLevelBasedValuenumber of explosions triggered when evaluated as a volume effect.fuseTicks- TheLevelBasedValuebaseline delay in ticks before detonation.fuseVariance- TheLevelBasedValuerandom +/- tick jitter applied to the fuse delay.spatialDelay- TheLevelBasedValueadditional delay in ticks per block of distance from the spell field epicenter.distribution- OptionalProbabilityDistributionused to sample detonation points when evaluated as a volume effect.entityFilter- OptionalContextAwarePredicaterestricting which entities trigger explosions when evaluated as an entity effect.
- All Implemented Interfaces:
SpellFieldEffect,SpellFieldEntityEffect,SpellFieldVolumeEffect
public record ExplodeEffect(ExplosionDefinition explosion, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue fuseTicks, net.minecraft.world.item.enchantment.LevelBasedValue fuseVariance, net.minecraft.world.item.enchantment.LevelBasedValue spatialDelay, Optional<ProbabilityDistribution> distribution, Optional<net.minecraft.advancements.critereon.ContextAwarePredicate> entityFilter)
extends Record
implements SpellFieldEntityEffect, SpellFieldVolumeEffect
Dual-purpose spell field effect implementing both
SpellFieldEntityEffect and
SpellFieldVolumeEffect that schedules one or more explosions configured by an
ExplosionDefinition.
Supports base fuse delays, randomized fuse variance, and distance-proportional spatial wave delays
($\text{distanceFromEpicenter} \cdot \text{spatialDelay}$) scheduled via SpellFieldTaskScheduler.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<ExplodeEffect> MapCodec for serializing and deserializingExplodeEffectinstances from JSON.static final StringJSON field key for the volume explosion count.static final StringJSON field key for the optional spatial probability distribution.static final StringJSON field key for the optional entity filter predicate.static final StringJSON field key for the nested explosion definition.static final StringJSON field key for the base fuse delay in ticks.static final StringJSON field key for the random fuse variance in ticks.static final StringRegistry path identifier for this spell field effect.static final LevelBasedKeyProviderSupplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation.static final StringJSON field key for the per-block distance delay in ticks. -
Constructor Summary
ConstructorsConstructorDescriptionExplodeEffect(ExplosionDefinition explosion, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue fuseTicks, net.minecraft.world.item.enchantment.LevelBasedValue fuseVariance, net.minecraft.world.item.enchantment.LevelBasedValue spatialDelay) Constructs an unfilteredExplodeEffectwith uniform volume sampling.ExplodeEffect(ExplosionDefinition explosion, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue fuseTicks, net.minecraft.world.item.enchantment.LevelBasedValue fuseVariance, net.minecraft.world.item.enchantment.LevelBasedValue spatialDelay, Optional<ProbabilityDistribution> distribution, Optional<net.minecraft.advancements.critereon.ContextAwarePredicate> entityFilter) Creates an instance of aExplodeEffectrecord class.ExplodeEffect(ExplosionDefinition explosion, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue fuseTicks, net.minecraft.world.item.enchantment.LevelBasedValue fuseVariance, net.minecraft.world.item.enchantment.LevelBasedValue spatialDelay, ProbabilityDistribution distribution) Constructs an unfilteredExplodeEffectwith a custom spatialProbabilityDistribution.ExplodeEffect(ExplosionDefinition explosion, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue fuseTicks, net.minecraft.world.item.enchantment.LevelBasedValue fuseVariance, net.minecraft.world.item.enchantment.LevelBasedValue spatialDelay, ProbabilityDistribution distribution, net.minecraft.advancements.critereon.ContextAwarePredicate entityFilter) Constructs anExplodeEffectwith both a customProbabilityDistributionand an entity filter.ExplodeEffect(ExplosionDefinition explosion, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue fuseTicks, net.minecraft.world.item.enchantment.LevelBasedValue fuseVariance, net.minecraft.world.item.enchantment.LevelBasedValue spatialDelay, net.minecraft.advancements.critereon.ContextAwarePredicate entityFilter) Constructs anExplodeEffectrestricted by an 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, List<GlobalVolume> volumes) Samplescount()points acrossvolumesusingdistribution()(or uniform sampling if absent) and schedules an explosion at each sampled coordinate.voidapply(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) Schedules an explosion centered atvictim's position with its blast radius scaled byvolumeScalarif the entity matchesentityFilter().com.mojang.serialization.MapCodec<? extends SpellFieldEntityEffect> codec()Retrieves theMapCodecresponsible for serializing and deserializing this effect.net.minecraft.world.item.enchantment.LevelBasedValuecount()Returns the value of thecountrecord component.Returns the value of thedistributionrecord component.Optional<net.minecraft.advancements.critereon.ContextAwarePredicate> Returns the value of theentityFilterrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theexplosionrecord component.net.minecraft.world.item.enchantment.LevelBasedValueReturns the value of thefuseTicksrecord component.net.minecraft.world.item.enchantment.LevelBasedValueReturns the value of thefuseVariancerecord component.final inthashCode()Returns a hash code value for this object.net.minecraft.world.item.enchantment.LevelBasedValueReturns the value of thespatialDelayrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
EXPLOSION
JSON field key for the nested explosion definition.- See Also:
-
COUNT
JSON field key for the volume explosion count.- See Also:
-
FUSE_TICKS
JSON field key for the base fuse delay in ticks.- See Also:
-
FUSE_VARIANCE
JSON field key for the random fuse variance in ticks.- See Also:
-
SPATIAL_DELAY
JSON field key for the per-block distance delay in ticks.- See Also:
-
DISTRIBUTION
JSON field key for the optional spatial probability distribution.- See Also:
-
ENTITY_FILTER
JSON field key for the optional entity filter predicate.- See Also:
-
KEY
Registry path identifier for this spell field effect.- See Also:
-
KEY_PROVIDER
Supplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation. -
CODEC
MapCodec for serializing and deserializingExplodeEffectinstances from JSON.
-
-
Constructor Details
-
ExplodeEffect
public ExplodeEffect(ExplosionDefinition explosion, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue fuseTicks, net.minecraft.world.item.enchantment.LevelBasedValue fuseVariance, net.minecraft.world.item.enchantment.LevelBasedValue spatialDelay) Constructs an unfilteredExplodeEffectwith uniform volume sampling.- Parameters:
explosion- The explosion parameters definition.count- The number of volume explosions.fuseTicks- The base fuse delay in ticks.fuseVariance- The random fuse variance in ticks.spatialDelay- The per-block spatial delay in ticks.
-
ExplodeEffect
public ExplodeEffect(ExplosionDefinition explosion, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue fuseTicks, net.minecraft.world.item.enchantment.LevelBasedValue fuseVariance, net.minecraft.world.item.enchantment.LevelBasedValue spatialDelay, ProbabilityDistribution distribution) Constructs an unfilteredExplodeEffectwith a custom spatialProbabilityDistribution.- Parameters:
explosion- The explosion parameters definition.count- The number of volume explosions.fuseTicks- The base fuse delay in ticks.fuseVariance- The random fuse variance in ticks.spatialDelay- The per-block spatial delay in ticks.distribution- The spatial probability distribution for volume sampling.
-
ExplodeEffect
public ExplodeEffect(ExplosionDefinition explosion, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue fuseTicks, net.minecraft.world.item.enchantment.LevelBasedValue fuseVariance, net.minecraft.world.item.enchantment.LevelBasedValue spatialDelay, net.minecraft.advancements.critereon.ContextAwarePredicate entityFilter) Constructs anExplodeEffectrestricted by an entity predicate filter.- Parameters:
explosion- The explosion parameters definition.count- The number of volume explosions.fuseTicks- The base fuse delay in ticks.fuseVariance- The random fuse variance in ticks.spatialDelay- The per-block spatial delay in ticks.entityFilter- The predicate filter to match against candidate entities.
-
ExplodeEffect
public ExplodeEffect(ExplosionDefinition explosion, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue fuseTicks, net.minecraft.world.item.enchantment.LevelBasedValue fuseVariance, net.minecraft.world.item.enchantment.LevelBasedValue spatialDelay, ProbabilityDistribution distribution, net.minecraft.advancements.critereon.ContextAwarePredicate entityFilter) Constructs anExplodeEffectwith both a customProbabilityDistributionand an entity filter.- Parameters:
explosion- The explosion parameters definition.count- The number of volume explosions.fuseTicks- The base fuse delay in ticks.fuseVariance- The random fuse variance in ticks.spatialDelay- The per-block spatial delay in ticks.distribution- The spatial probability distribution for volume sampling.entityFilter- The predicate filter to match against candidate entities.
-
ExplodeEffect
public ExplodeEffect(ExplosionDefinition explosion, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue fuseTicks, net.minecraft.world.item.enchantment.LevelBasedValue fuseVariance, net.minecraft.world.item.enchantment.LevelBasedValue spatialDelay, Optional<ProbabilityDistribution> distribution, Optional<net.minecraft.advancements.critereon.ContextAwarePredicate> entityFilter) Creates an instance of aExplodeEffectrecord class.- Parameters:
explosion- the value for theexplosionrecord componentcount- the value for thecountrecord componentfuseTicks- the value for thefuseTicksrecord componentfuseVariance- the value for thefuseVariancerecord componentspatialDelay- the value for thespatialDelayrecord componentdistribution- the value for thedistributionrecord 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) Schedules an explosion centered atvictim's position with its blast radius scaled byvolumeScalarif the entity 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.
-
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, List<GlobalVolume> volumes) Samplescount()points acrossvolumesusingdistribution()(or uniform sampling if absent) and schedules an explosion at each sampled coordinate.- Specified by:
applyin interfaceSpellFieldVolumeEffect- 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.volumes- The list of evaluated world-spaceGlobalVolumes defining the spell field geometry.
-
codec
Description copied from interface:SpellFieldEffectRetrieves theMapCodecresponsible for serializing and deserializing this effect.- Specified by:
codecin interfaceSpellFieldEffect- Returns:
- The registered
MapCodecinstance.
-
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). -
explosion
Returns the value of theexplosionrecord component.- Returns:
- the value of the
explosionrecord component
-
count
public net.minecraft.world.item.enchantment.LevelBasedValue count()Returns the value of thecountrecord component.- Returns:
- the value of the
countrecord component
-
fuseTicks
public net.minecraft.world.item.enchantment.LevelBasedValue fuseTicks()Returns the value of thefuseTicksrecord component.- Returns:
- the value of the
fuseTicksrecord component
-
fuseVariance
public net.minecraft.world.item.enchantment.LevelBasedValue fuseVariance()Returns the value of thefuseVariancerecord component.- Returns:
- the value of the
fuseVariancerecord component
-
spatialDelay
public net.minecraft.world.item.enchantment.LevelBasedValue spatialDelay()Returns the value of thespatialDelayrecord component.- Returns:
- the value of the
spatialDelayrecord component
-
distribution
Returns the value of thedistributionrecord component.- Returns:
- the value of the
distributionrecord component
-
entityFilter
Returns the value of theentityFilterrecord component.- Returns:
- the value of the
entityFilterrecord component
-