Record Class AmbientFieldVisualEffect
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.spellfield.effect.visual.AmbientFieldVisualEffect
- Record Components:
particle- TheParticleOptionsdefining the particle type to spawn.count- TheLevelBasedValuetotal number of particles spawned per evaluation cycle.speed- TheLevelBasedValuespeed multiplier applied to each particle's random velocity vector.distribution- TheProbabilityDistributionused to sample topological spawn coordinates across the volumes.
- All Implemented Interfaces:
SpellFieldEffect, SpellFieldVisualEffect
public record AmbientFieldVisualEffect(net.minecraft.core.particles.ParticleOptions particle, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue speed, ProbabilityDistribution distribution)
extends Record
implements SpellFieldVisualEffect
A
SpellFieldVisualEffect that spawns ambient particles with random omnidirectional drift
velocities at coordinates sampled across the spell field's GlobalVolumes via a
ProbabilityDistribution.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<AmbientFieldVisualEffect> MapCodec for serializing and deserializingAmbientFieldVisualEffectinstances 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 particle speed multiplier. -
Constructor Summary
ConstructorsConstructorDescriptionAmbientFieldVisualEffect(net.minecraft.core.particles.ParticleOptions particle, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue speed, ProbabilityDistribution distribution) Creates an instance of aAmbientFieldVisualEffectrecord 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 target, net.minecraft.world.phys.Vec3 epicenter, List<GlobalVolume> volumes, List<FieldAxis> activeAxes) Samplescount()points acrossvolumesusingdistribution()and broadcasts single-particle packets (`count = 0`) with randomized velocity vectors scaled byspeed().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
-
COUNT
-
SPEED
-
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 deserializingAmbientFieldVisualEffectinstances from JSON.
-
-
Constructor Details
-
AmbientFieldVisualEffect
public AmbientFieldVisualEffect(net.minecraft.core.particles.ParticleOptions particle, net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue speed, ProbabilityDistribution distribution) Creates an instance of aAmbientFieldVisualEffectrecord class.- Parameters:
particle- the value for theparticlerecord componentcount- the value for thecountrecord componentspeed- the value for thespeedrecord 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 acrossvolumesusingdistribution()and broadcasts single-particle packets (`count = 0`) with randomized velocity vectors scaled byspeed().- 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
-
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). -
particle
-
count
-
speed
-
distribution
Returns the value of thedistributionrecord component.- Returns:
- the value of the
distributionrecord component
-