Record Class SpellFieldVolume
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.spellfield.shape.SpellFieldVolume
- Record Components:
shape- Optional outer bounding boxSpellFieldShape; if absent, bounds are derived fromtopology().offset- OptionalSpatialVectordisplacement applied to the evaluation epicenter or bounding box.topology- OptionalFieldTopologygoverning distance falloff and directional multipliers within the volume.
public record SpellFieldVolume(Optional<SpellFieldShape> shape, Optional<SpatialVector> offset, Optional<FieldTopology> topology)
extends Record
Represents a single spatial sub-volume within a
SpellFieldComponent,
pairing an optional outer SpellFieldShape and SpatialVector offset with an optional
internal FieldTopology.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<SpellFieldVolume> Codec for serializing and deserializingSpellFieldVolumeinstances from JSON.static final LevelBasedKeyProviderSupplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation.static final StringJSON field key for the spatial translation offset.static final StringJSON field key for the outer bounding shape.static final StringJSON field key for the internal field topology. -
Constructor Summary
ConstructorsConstructorDescriptionSpellFieldVolume(Optional<SpellFieldShape> shape, Optional<SpatialVector> offset, Optional<FieldTopology> topology) Creates an instance of aSpellFieldVolumerecord class. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.phys.AABBcomputeBounds(net.minecraft.world.entity.Entity caster, net.minecraft.world.phys.Vec3 baseEpicenter, int enchantmentLevel) Computes the world-space axis-aligned bounding box (AABB) enclosing this volume.net.minecraft.world.phys.Vec3computeEvaluationEpicenter(net.minecraft.world.entity.Entity caster, net.minecraft.world.phys.Vec3 baseEpicenter, int enchantmentLevel) Computes the world-space epicenter used for topological evaluation of this volume.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.offset()Returns the value of theoffsetrecord component.shape()Returns the value of theshaperecord component.topology()Returns the value of thetopologyrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
SHAPE
JSON field key for the outer bounding shape.- See Also:
-
OFFSET
JSON field key for the spatial translation offset.- See Also:
-
TOPOLOGY
JSON field key for the internal field topology.- See Also:
-
KEY_PROVIDER
Supplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation. -
CODEC
Codec for serializing and deserializingSpellFieldVolumeinstances from JSON.
-
-
Constructor Details
-
SpellFieldVolume
public SpellFieldVolume(Optional<SpellFieldShape> shape, Optional<SpatialVector> offset, Optional<FieldTopology> topology) Creates an instance of aSpellFieldVolumerecord class.
-
-
Method Details
-
computeEvaluationEpicenter
public net.minecraft.world.phys.Vec3 computeEvaluationEpicenter(net.minecraft.world.entity.Entity caster, net.minecraft.world.phys.Vec3 baseEpicenter, int enchantmentLevel) Computes the world-space epicenter used for topological evaluation of this volume.- Parameters:
caster- The reference entity anchoring the volume.baseEpicenter- The base world-space epicenter of the parent spell field.enchantmentLevel- The active level of the enchantment.- Returns:
- The translated world-space evaluation epicenter.
-
computeBounds
public net.minecraft.world.phys.AABB computeBounds(net.minecraft.world.entity.Entity caster, net.minecraft.world.phys.Vec3 baseEpicenter, int enchantmentLevel) Computes the world-space axis-aligned bounding box (AABB) enclosing this volume.Uses
shape()if present, or falls back toFieldTopology.computeAABB(int, Entity, Vec3)when only a topology is defined.- Parameters:
caster- The reference entity anchoring the volume.baseEpicenter- The base world-space epicenter of the parent spell field.enchantmentLevel- The active level of the enchantment.- Returns:
- The computed world-space
AABB.
-
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). -
shape
Returns the value of theshaperecord component.- Returns:
- the value of the
shaperecord component
-
offset
Returns the value of theoffsetrecord component.- Returns:
- the value of the
offsetrecord component
-
topology
Returns the value of thetopologyrecord component.- Returns:
- the value of the
topologyrecord component
-