Record Class SpellFieldVolume

java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.spellfield.shape.SpellFieldVolume
Record Components:
shape - Optional outer bounding box SpellFieldShape; if absent, bounds are derived from topology().
offset - Optional SpatialVector displacement applied to the evaluation epicenter or bounding box.
topology - Optional FieldTopology governing 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 Details

    • SHAPE

      public static final String SHAPE
      JSON field key for the outer bounding shape.
      See Also:
    • OFFSET

      public static final String OFFSET
      JSON field key for the spatial translation offset.
      See Also:
    • TOPOLOGY

      public static final String TOPOLOGY
      JSON field key for the internal field topology.
      See Also:
    • KEY_PROVIDER

      public static final LevelBasedKeyProvider KEY_PROVIDER
      Supplies the JSON property keys holding LevelBasedValue definitions for data transformation.
    • CODEC

      public static final com.mojang.serialization.Codec<SpellFieldVolume> CODEC
      Codec for serializing and deserializing SpellFieldVolume instances from JSON.
  • Constructor Details

  • 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 to FieldTopology.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

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • shape

      public Optional<SpellFieldShape> shape()
      Returns the value of the shape record component.
      Returns:
      the value of the shape record component
    • offset

      public Optional<SpatialVector> offset()
      Returns the value of the offset record component.
      Returns:
      the value of the offset record component
    • topology

      public Optional<FieldTopology> topology()
      Returns the value of the topology record component.
      Returns:
      the value of the topology record component