Record Class CuboidShape
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.spellfield.shape.CuboidShape
- Record Components:
xRadius- TheLevelBasedValuehalf-extent along the global $X$ axis.yRadius- TheLevelBasedValuehalf-extent along the global $Y$ axis.zRadius- TheLevelBasedValuehalf-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
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<CuboidShape> MapCodec for serializing and deserializingCuboidShapeinstances from JSON.static final StringRegistry path identifier for this spell field shape.static final LevelBasedKeyProviderSupplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation.static final StringJSON field key for the X-axis half-extent.static final StringJSON field key for the Y-axis half-extent.static final StringJSON field key for the Z-axis half-extent. -
Constructor Summary
ConstructorsConstructorDescriptionCuboidShape(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 aCuboidShaperecord class. -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.serialization.MapCodec<? extends SpellFieldShape> codec()Retrieves theMapCodecresponsible for serializing and deserializing this shape definition.net.minecraft.world.phys.AABBcomputeBounds(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 booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.net.minecraft.world.item.enchantment.LevelBasedValuexRadius()Returns the value of thexRadiusrecord component.net.minecraft.world.item.enchantment.LevelBasedValueyRadius()Returns the value of theyRadiusrecord component.net.minecraft.world.item.enchantment.LevelBasedValuezRadius()Returns the value of thezRadiusrecord component.
-
Field Details
-
X_RADIUS
-
Y_RADIUS
-
Z_RADIUS
-
KEY
-
KEY_PROVIDER
Supplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation. -
CODEC
MapCodec for serializing and deserializingCuboidShapeinstances 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 aCuboidShaperecord class.
-
-
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:SpellFieldShapeComputes the world-space axis-aligned bounding box enclosing the shape at the given epicenter.- Specified by:
computeBoundsin interfaceSpellFieldShape- Parameters:
owner- The reference entity anchoring or orienting the shape, ornull.epicenter- The world-space center coordinate of the shape evaluation.enchantmentLevel- The active level of the spell field enchantment.- Returns:
- The computed world-space
AABBrestricting field evaluation.
-
codec
Description copied from interface:SpellFieldShapeRetrieves theMapCodecresponsible for serializing and deserializing this shape definition.- Specified by:
codecin interfaceSpellFieldShape- 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). -
xRadius
-
yRadius
-
zRadius
-