Record Class OrbitEffect
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.spellfield.effect.entity.OrbitEffect
- Record Components:
attractionStrength- TheLevelBasedValuerestoring force pulling entities toward the orbital ring/shell.orbitalRadius- TheLevelBasedValuetarget radius (in blocks) of the orbital ring from the epicenter.orbitVelocity- TheLevelBasedValuetangential speed imparted along the orbital path.dragMultiplier- TheLevelBasedValuehorizontal velocity damping factor applied each tick prior to impulse addition.distanceScaling- TheDistanceScalingFunctionmodulating the radial restoring force based on distance from the target ring.axis- OptionalFieldAxisnormal vector defining a structured 2D orbital plane.rotationDirection- TheRotationDirection(clockwise, counter-clockwise, or entity-ID parity) of the orbit.entityFilter- OptionalLootItemConditionrestricting which entities are pulled into orbit.
- All Implemented Interfaces:
DirectionalSpellFieldEffect, SpellFieldEffect, SpellFieldEntityEffect
public record OrbitEffect(net.minecraft.world.item.enchantment.LevelBasedValue attractionStrength, net.minecraft.world.item.enchantment.LevelBasedValue orbitalRadius, net.minecraft.world.item.enchantment.LevelBasedValue orbitVelocity, net.minecraft.world.item.enchantment.LevelBasedValue dragMultiplier, DistanceScalingFunction distanceScaling, Optional<FieldAxis> axis, RotationDirection rotationDirection, Optional<net.minecraft.core.Holder<net.minecraft.world.level.storage.loot.predicates.LootItemCondition>> entityFilter)
extends Record
implements SpellFieldEntityEffect, DirectionalSpellFieldEffect
A directional
SpellFieldEntityEffect that guides targeted entities into a stable circular
or spherical orbit at a configurable orbitalRadius() around the spell field epicenter.
When an orientation axis() is provided, entities are pulled onto the orthogonal orbital plane
and accelerated tangentially around that axis; when axis() is empty, entities enter a chaotic
3D spherical shell orbit.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringJSON field key for the radial restoring attraction strength.static final StringJSON field key for the optional orbital plane normal axis.static final com.mojang.serialization.MapCodec<OrbitEffect> MapCodec for serializing and deserializingOrbitEffectinstances from JSON.static final StringJSON field key for the radial error distance scaling function.static final StringJSON field key for the velocity damping drag factor.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 tangential orbital speed.static final StringJSON field key for the target orbital radius.static final StringJSON field key for the orbital rotation chirality. -
Constructor Summary
ConstructorsConstructorDescriptionOrbitEffect(net.minecraft.world.item.enchantment.LevelBasedValue attractionStrength, net.minecraft.world.item.enchantment.LevelBasedValue orbitalRadius, net.minecraft.world.item.enchantment.LevelBasedValue orbitVelocity, net.minecraft.world.item.enchantment.LevelBasedValue dragMultiplier, DistanceScalingFunction distanceScaling, Optional<FieldAxis> axis, RotationDirection rotationDirection, Optional<net.minecraft.core.Holder<net.minecraft.world.level.storage.loot.predicates.LootItemCondition>> entityFilter) Creates an instance of aOrbitEffectrecord class.OrbitEffect(net.minecraft.world.item.enchantment.LevelBasedValue attractionStrength, net.minecraft.world.item.enchantment.LevelBasedValue orbitalRadius, net.minecraft.world.item.enchantment.LevelBasedValue orbitVelocity, net.minecraft.world.item.enchantment.LevelBasedValue dragMultiplier, DistanceScalingFunction distanceScaling, FieldAxis axis, RotationDirection rotationDirection) Constructs an unfiltered planarOrbitEffectaround the specifiedFieldAxis.OrbitEffect(net.minecraft.world.item.enchantment.LevelBasedValue attractionStrength, net.minecraft.world.item.enchantment.LevelBasedValue orbitalRadius, net.minecraft.world.item.enchantment.LevelBasedValue orbitVelocity, net.minecraft.world.item.enchantment.LevelBasedValue dragMultiplier, DistanceScalingFunction distanceScaling, FieldAxis axis, RotationDirection rotationDirection, net.minecraft.core.Holder<net.minecraft.world.level.storage.loot.predicates.LootItemCondition> entityFilter) Constructs a planarOrbitEffectaround the specifiedFieldAxisand restricted by an entity filter.OrbitEffect(net.minecraft.world.item.enchantment.LevelBasedValue attractionStrength, net.minecraft.world.item.enchantment.LevelBasedValue orbitalRadius, net.minecraft.world.item.enchantment.LevelBasedValue orbitVelocity, net.minecraft.world.item.enchantment.LevelBasedValue dragMultiplier, DistanceScalingFunction distanceScaling, RotationDirection rotationDirection) Constructs an unfiltered sphericalOrbitEffect(no fixed axis).OrbitEffect(net.minecraft.world.item.enchantment.LevelBasedValue attractionStrength, net.minecraft.world.item.enchantment.LevelBasedValue orbitalRadius, net.minecraft.world.item.enchantment.LevelBasedValue orbitVelocity, net.minecraft.world.item.enchantment.LevelBasedValue dragMultiplier, DistanceScalingFunction distanceScaling, RotationDirection rotationDirection, net.minecraft.core.Holder<net.minecraft.world.level.storage.loot.predicates.LootItemCondition> entityFilter) Constructs a sphericalOrbitEffectrestricted 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, net.minecraft.world.entity.Entity victim, float volumeScalar) Applies velocity damping, radial/planar ring-restoring attraction, and tangential orbital thrust tovictim, including anti-gravity compensation for floating items and experience orbs.net.minecraft.world.item.enchantment.LevelBasedValueReturns the value of theattractionStrengthrecord component.axis()Returns the value of theaxisrecord component.com.mojang.serialization.MapCodec<? extends SpellFieldEntityEffect> codec()Retrieves theMapCodecresponsible for serializing and deserializing this effect.Returns the value of thedistanceScalingrecord component.net.minecraft.world.item.enchantment.LevelBasedValueReturns the value of thedragMultiplierrecord component.Optional<net.minecraft.core.Holder<net.minecraft.world.level.storage.loot.predicates.LootItemCondition>> Returns the value of theentityFilterrecord component.final booleanIndicates whether some other object is "equal to" this one.Retrieves the activeFieldAxisalong which this effect operates.final inthashCode()Returns a hash code value for this object.net.minecraft.world.item.enchantment.LevelBasedValueReturns the value of theorbitalRadiusrecord component.net.minecraft.world.item.enchantment.LevelBasedValueReturns the value of theorbitVelocityrecord component.Returns the value of therotationDirectionrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
ATTRACTION_STRENGTH
JSON field key for the radial restoring attraction strength.- See Also:
-
ORBITAL_RADIUS
-
ORBIT_VELOCITY
JSON field key for the tangential orbital speed.- See Also:
-
DRAG_MULTIPLIER
JSON field key for the velocity damping drag factor.- See Also:
-
DISTANCE_SCALING
JSON field key for the radial error distance scaling function.- See Also:
-
AXIS
JSON field key for the optional orbital plane normal axis.- See Also:
-
ROTATION_DIRECTION
JSON field key for the orbital rotation chirality.- 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 deserializingOrbitEffectinstances from JSON.
-
-
Constructor Details
-
OrbitEffect
public OrbitEffect(net.minecraft.world.item.enchantment.LevelBasedValue attractionStrength, net.minecraft.world.item.enchantment.LevelBasedValue orbitalRadius, net.minecraft.world.item.enchantment.LevelBasedValue orbitVelocity, net.minecraft.world.item.enchantment.LevelBasedValue dragMultiplier, DistanceScalingFunction distanceScaling, RotationDirection rotationDirection) Constructs an unfiltered sphericalOrbitEffect(no fixed axis).- Parameters:
attractionStrength- The radial attraction strength.orbitalRadius- The target orbital radius.orbitVelocity- The tangential orbital velocity.dragMultiplier- The velocity damping factor.distanceScaling- The radial error distance scaling function.rotationDirection- The orbital rotation direction.
-
OrbitEffect
public OrbitEffect(net.minecraft.world.item.enchantment.LevelBasedValue attractionStrength, net.minecraft.world.item.enchantment.LevelBasedValue orbitalRadius, net.minecraft.world.item.enchantment.LevelBasedValue orbitVelocity, net.minecraft.world.item.enchantment.LevelBasedValue dragMultiplier, DistanceScalingFunction distanceScaling, FieldAxis axis, RotationDirection rotationDirection) Constructs an unfiltered planarOrbitEffectaround the specifiedFieldAxis.- Parameters:
attractionStrength- The radial attraction strength.orbitalRadius- The target orbital radius.orbitVelocity- The tangential orbital velocity.dragMultiplier- The velocity damping factor.distanceScaling- The radial error distance scaling function.axis- The orbital plane normal axis.rotationDirection- The orbital rotation direction.
-
OrbitEffect
public OrbitEffect(net.minecraft.world.item.enchantment.LevelBasedValue attractionStrength, net.minecraft.world.item.enchantment.LevelBasedValue orbitalRadius, net.minecraft.world.item.enchantment.LevelBasedValue orbitVelocity, net.minecraft.world.item.enchantment.LevelBasedValue dragMultiplier, DistanceScalingFunction distanceScaling, RotationDirection rotationDirection, net.minecraft.core.Holder<net.minecraft.world.level.storage.loot.predicates.LootItemCondition> entityFilter) Constructs a sphericalOrbitEffectrestricted by an entity predicate filter.- Parameters:
attractionStrength- The radial attraction strength.orbitalRadius- The target orbital radius.orbitVelocity- The tangential orbital velocity.dragMultiplier- The velocity damping factor.distanceScaling- The radial error distance scaling function.rotationDirection- The orbital rotation direction.entityFilter- The predicate filter to match against candidate entities.
-
OrbitEffect
public OrbitEffect(net.minecraft.world.item.enchantment.LevelBasedValue attractionStrength, net.minecraft.world.item.enchantment.LevelBasedValue orbitalRadius, net.minecraft.world.item.enchantment.LevelBasedValue orbitVelocity, net.minecraft.world.item.enchantment.LevelBasedValue dragMultiplier, DistanceScalingFunction distanceScaling, FieldAxis axis, RotationDirection rotationDirection, net.minecraft.core.Holder<net.minecraft.world.level.storage.loot.predicates.LootItemCondition> entityFilter) Constructs a planarOrbitEffectaround the specifiedFieldAxisand restricted by an entity filter.- Parameters:
attractionStrength- The radial attraction strength.orbitalRadius- The target orbital radius.orbitVelocity- The tangential orbital velocity.dragMultiplier- The velocity damping factor.distanceScaling- The radial error distance scaling function.axis- The orbital plane normal axis.rotationDirection- The orbital rotation direction.entityFilter- The predicate filter to match against candidate entities.
-
OrbitEffect
public OrbitEffect(net.minecraft.world.item.enchantment.LevelBasedValue attractionStrength, net.minecraft.world.item.enchantment.LevelBasedValue orbitalRadius, net.minecraft.world.item.enchantment.LevelBasedValue orbitVelocity, net.minecraft.world.item.enchantment.LevelBasedValue dragMultiplier, DistanceScalingFunction distanceScaling, Optional<FieldAxis> axis, RotationDirection rotationDirection, Optional<net.minecraft.core.Holder<net.minecraft.world.level.storage.loot.predicates.LootItemCondition>> entityFilter) Creates an instance of aOrbitEffectrecord class.- Parameters:
attractionStrength- the value for theattractionStrengthrecord componentorbitalRadius- the value for theorbitalRadiusrecord componentorbitVelocity- the value for theorbitVelocityrecord componentdragMultiplier- the value for thedragMultiplierrecord componentdistanceScaling- the value for thedistanceScalingrecord componentaxis- the value for theaxisrecord componentrotationDirection- the value for therotationDirectionrecord 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) Applies velocity damping, radial/planar ring-restoring attraction, and tangential orbital thrust tovictim, including anti-gravity compensation for floating items and experience orbs.- 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.
-
getActiveAxis
Description copied from interface:DirectionalSpellFieldEffectRetrieves the activeFieldAxisalong which this effect operates.- Specified by:
getActiveAxisin interfaceDirectionalSpellFieldEffect- Returns:
- An
Optionalcontaining the configuredFieldAxis, or empty if no directional axis is active.
-
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). -
attractionStrength
public net.minecraft.world.item.enchantment.LevelBasedValue attractionStrength()Returns the value of theattractionStrengthrecord component.- Returns:
- the value of the
attractionStrengthrecord component
-
orbitalRadius
public net.minecraft.world.item.enchantment.LevelBasedValue orbitalRadius()Returns the value of theorbitalRadiusrecord component.- Returns:
- the value of the
orbitalRadiusrecord component
-
orbitVelocity
public net.minecraft.world.item.enchantment.LevelBasedValue orbitVelocity()Returns the value of theorbitVelocityrecord component.- Returns:
- the value of the
orbitVelocityrecord component
-
dragMultiplier
public net.minecraft.world.item.enchantment.LevelBasedValue dragMultiplier()Returns the value of thedragMultiplierrecord component.- Returns:
- the value of the
dragMultiplierrecord component
-
distanceScaling
Returns the value of thedistanceScalingrecord component.- Returns:
- the value of the
distanceScalingrecord component
-
axis
-
rotationDirection
Returns the value of therotationDirectionrecord component.- Returns:
- the value of the
rotationDirectionrecord component
-
entityFilter
public Optional<net.minecraft.core.Holder<net.minecraft.world.level.storage.loot.predicates.LootItemCondition>> entityFilter()Returns the value of theentityFilterrecord component.- Returns:
- the value of the
entityFilterrecord component
-