Record Class CuboidShape

java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.spellfield.shape.CuboidShape
Record Components:
xRadius - The LevelBasedValue half-extent along the global $X$ axis.
yRadius - The LevelBasedValue half-extent along the global $Y$ axis.
zRadius - The LevelBasedValue half-extent along the global $Z$ axis.
All Implemented Interfaces:
SpellFieldShape

public record CuboidShape(net.minecraft.world.item.enchantment.LevelBasedValue xRadius, net.minecraft.world.item.enchantment.LevelBasedValue yRadius, net.minecraft.world.item.enchantment.LevelBasedValue zRadius) extends Record implements SpellFieldShape
An axis-aligned rectangular prism SpellFieldShape with independent half-extents along the global $X$, $Y$, and $Z$ axes.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.MapCodec<CuboidShape>
    MapCodec for serializing and deserializing CuboidShape instances from JSON.
    static final String
    Registry path identifier for this spell field shape.
    Supplies the JSON property keys holding LevelBasedValue definitions for data transformation.
    static final String
    JSON field key for the X-axis half-extent.
    static final String
    JSON field key for the Y-axis half-extent.
    static final String
    JSON field key for the Z-axis half-extent.
  • Constructor Summary

    Constructors
    Constructor
    Description
    CuboidShape(net.minecraft.world.item.enchantment.LevelBasedValue xRadius, net.minecraft.world.item.enchantment.LevelBasedValue yRadius, net.minecraft.world.item.enchantment.LevelBasedValue zRadius)
    Creates an instance of a CuboidShape record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.mojang.serialization.MapCodec<? extends SpellFieldShape>
    Retrieves the MapCodec responsible for serializing and deserializing this shape definition.
    net.minecraft.world.phys.AABB
    computeBounds(net.minecraft.world.entity.Entity owner, net.minecraft.world.phys.Vec3 epicenter, int enchantmentLevel)
    Computes the world-space axis-aligned bounding box enclosing the shape at the given epicenter.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    final String
    Returns a string representation of this record class.
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the xRadius record component.
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the yRadius record component.
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the zRadius record component.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • X_RADIUS

      public static final String X_RADIUS
      JSON field key for the X-axis half-extent.
      See Also:
    • Y_RADIUS

      public static final String Y_RADIUS
      JSON field key for the Y-axis half-extent.
      See Also:
    • Z_RADIUS

      public static final String Z_RADIUS
      JSON field key for the Z-axis half-extent.
      See Also:
    • KEY

      public static final String KEY
      Registry path identifier for this spell field shape.
      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.MapCodec<CuboidShape> CODEC
      MapCodec for serializing and deserializing CuboidShape instances from JSON.
  • Constructor Details

    • CuboidShape

      public CuboidShape(net.minecraft.world.item.enchantment.LevelBasedValue xRadius, net.minecraft.world.item.enchantment.LevelBasedValue yRadius, net.minecraft.world.item.enchantment.LevelBasedValue zRadius)
      Creates an instance of a CuboidShape record class.
      Parameters:
      xRadius - the value for the xRadius record component
      yRadius - the value for the yRadius record component
      zRadius - the value for the zRadius record component
  • Method Details

    • computeBounds

      public net.minecraft.world.phys.AABB computeBounds(net.minecraft.world.entity.Entity owner, net.minecraft.world.phys.Vec3 epicenter, int enchantmentLevel)
      Description copied from interface: SpellFieldShape
      Computes the world-space axis-aligned bounding box enclosing the shape at the given epicenter.
      Specified by:
      computeBounds in interface SpellFieldShape
      Parameters:
      owner - The reference entity anchoring or orienting the shape, or null.
      epicenter - The world-space center coordinate of the shape evaluation.
      enchantmentLevel - The active level of the spell field enchantment.
      Returns:
      The computed world-space AABB restricting field evaluation.
    • codec

      public com.mojang.serialization.MapCodec<? extends SpellFieldShape> codec()
      Description copied from interface: SpellFieldShape
      Retrieves the MapCodec responsible for serializing and deserializing this shape definition.
      Specified by:
      codec in interface SpellFieldShape
      Returns:
      The registered MapCodec instance.
    • 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.
    • xRadius

      public net.minecraft.world.item.enchantment.LevelBasedValue xRadius()
      Returns the value of the xRadius record component.
      Returns:
      the value of the xRadius record component
    • yRadius

      public net.minecraft.world.item.enchantment.LevelBasedValue yRadius()
      Returns the value of the yRadius record component.
      Returns:
      the value of the yRadius record component
    • zRadius

      public net.minecraft.world.item.enchantment.LevelBasedValue zRadius()
      Returns the value of the zRadius record component.
      Returns:
      the value of the zRadius record component