Record Class VectorFieldVisualEffect
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.spellfield.effect.visual.VectorFieldVisualEffect
- Record Components:
particle- TheParticleOptionsdefining the particle type to spawn.count- TheLevelBasedValuetotal number of particles spawned per evaluation cycle.speed- TheLevelBasedValuesigned speed multiplier (negative values invert the directional polarity).axis- Optional explicitFieldAxisoverriding automatic axis inheritance from sibling effects.distribution- TheProbabilityDistributionused to sample topological spawn coordinates across the volumes.
- All Implemented Interfaces:
SpellFieldEffect,SpellFieldVisualEffect
public record VectorFieldVisualEffect(net.minecraft.core.particles.ParticleOptions particle, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue speed, Optional<FieldAxis> axis, ProbabilityDistribution distribution)
extends Record
implements SpellFieldVisualEffect
A
SpellFieldVisualEffect that spawns directional particles across the spell field's
GlobalVolumes whose velocity vectors align with a configured FieldAxis or
automatically inherit the active axes of sibling DirectionalSpellFieldEffects.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringJSON field key for the optional explicit directional axis.static final com.mojang.serialization.MapCodec<VectorFieldVisualEffect> MapCodec for serializing and deserializingVectorFieldVisualEffectinstances from JSON.static final StringJSON field key for the particle count.static final StringJSON field key for the spatial probability distribution.static final StringRegistry path identifier for this spell field visual effect.static final LevelBasedKeyProviderSupplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation.static final StringJSON field key for the particle options definition.static final StringJSON field key for the signed particle speed multiplier. -
Constructor Summary
ConstructorsConstructorDescriptionVectorFieldVisualEffect(net.minecraft.core.particles.ParticleOptions particle, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue speed, Optional<FieldAxis> axis, ProbabilityDistribution distribution) Creates an instance of aVectorFieldVisualEffectrecord class.VectorFieldVisualEffect(net.minecraft.core.particles.ParticleOptions particle, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue speed, ProbabilityDistribution distribution) Constructs aVectorFieldVisualEffectthat automatically inherits its directional axis from sibling effects in the spell field.VectorFieldVisualEffect(net.minecraft.core.particles.ParticleOptions particle, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue speed, FieldAxis axis, ProbabilityDistribution distribution) Constructs aVectorFieldVisualEffectaligned with an explicitFieldAxis. -
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 target, net.minecraft.world.phys.Vec3 epicenter, List<GlobalVolume> volumes, List<FieldAxis> activeAxes) axis()Returns the value of theaxisrecord component.com.mojang.serialization.MapCodec<? extends SpellFieldVisualEffect> 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.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.net.minecraft.core.particles.ParticleOptionsparticle()Returns the value of theparticlerecord component.net.minecraft.world.item.enchantment.LevelBasedValuespeed()Returns the value of thespeedrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
PARTICLE
JSON field key for the particle options definition.- See Also:
-
COUNT
JSON field key for the particle count.- See Also:
-
SPEED
JSON field key for the signed particle speed multiplier.- See Also:
-
AXIS
JSON field key for the optional explicit directional axis.- See Also:
-
DISTRIBUTION
JSON field key for the spatial probability distribution.- See Also:
-
KEY
Registry path identifier for this spell field visual effect.- See Also:
-
KEY_PROVIDER
Supplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation. -
CODEC
MapCodec for serializing and deserializingVectorFieldVisualEffectinstances from JSON.
-
-
Constructor Details
-
VectorFieldVisualEffect
public VectorFieldVisualEffect(net.minecraft.core.particles.ParticleOptions particle, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue speed, ProbabilityDistribution distribution) Constructs aVectorFieldVisualEffectthat automatically inherits its directional axis from sibling effects in the spell field.- Parameters:
particle- The particle options to spawn.count- TheLevelBasedValueparticle count.speed- TheLevelBasedValuesigned particle speed.distribution- The spatial probability distribution for sampling spawn points.
-
VectorFieldVisualEffect
public VectorFieldVisualEffect(net.minecraft.core.particles.ParticleOptions particle, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue speed, FieldAxis axis, ProbabilityDistribution distribution) Constructs aVectorFieldVisualEffectaligned with an explicitFieldAxis.- Parameters:
particle- The particle options to spawn.count- TheLevelBasedValueparticle count.speed- TheLevelBasedValuesigned particle speed.axis- The explicitFieldAxisdictating particle velocity direction.distribution- The spatial probability distribution for sampling spawn points.
-
VectorFieldVisualEffect
public VectorFieldVisualEffect(net.minecraft.core.particles.ParticleOptions particle, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue speed, Optional<FieldAxis> axis, ProbabilityDistribution distribution) Creates an instance of aVectorFieldVisualEffectrecord class.- Parameters:
particle- the value for theparticlerecord componentcount- the value for thecountrecord componentspeed- the value for thespeedrecord componentaxis- the value for theaxisrecord componentdistribution- the value for thedistributionrecord 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 target, net.minecraft.world.phys.Vec3 epicenter, List<GlobalVolume> volumes, List<FieldAxis> activeAxes) Samplescount()points acrossvolumesand spawns velocity-aligned particles alongaxis()(or a randomly chosen axis fromactiveAxes, falling back to random omnidirectional drift if no axis is available).- Specified by:
applyin interfaceSpellFieldVisualEffect- Parameters:
level- The executing server level.enchantmentLevel- The active level of the spell field enchantment.context- The item usage context triggering the spell field.target- 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.activeAxes- The list of active directionalFieldAxisinstances collected from sibling effects.
-
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). -
particle
public net.minecraft.core.particles.ParticleOptions particle()Returns the value of theparticlerecord component.- Returns:
- the value of the
particlerecord component
-
count
public net.minecraft.world.item.enchantment.LevelBasedValue count()Returns the value of thecountrecord component.- Returns:
- the value of the
countrecord component
-
speed
public net.minecraft.world.item.enchantment.LevelBasedValue speed()Returns the value of thespeedrecord component.- Returns:
- the value of the
speedrecord component
-
axis
Returns the value of theaxisrecord component.- Returns:
- the value of the
axisrecord component
-
distribution
Returns the value of thedistributionrecord component.- Returns:
- the value of the
distributionrecord component
-