Record Class DeepCuboidShape
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.spellfield.shape.DeepCuboidShape
- Record Components:
heightWidthRadius- TheLevelBasedValuehalf-extent applied to the two axes perpendicular to the look axis.depthRadius- TheLevelBasedValuehalf-extent applied along the primary cardinal look axis.
- All Implemented Interfaces:
SpellFieldShape
public record DeepCuboidShape(net.minecraft.world.item.enchantment.LevelBasedValue heightWidthRadius, net.minecraft.world.item.enchantment.LevelBasedValue depthRadius)
extends Record
implements SpellFieldShape
An orientation-aware cuboid
SpellFieldShape that aligns its depthRadius() with the
nearest cardinal axis (including vertical up/down) of the caster's 3D look vector, while applying
heightWidthRadius() to the two orthogonal cross-sectional axes (ideal for 3D tunnel mining).-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<DeepCuboidShape> MapCodec for serializing and deserializingDeepCuboidShapeinstances from JSON.static final StringJSON field key for the longitudinal depth half-extent.static final StringJSON field key for the cross-sectional height/width half-extent.static final StringRegistry path identifier for this spell field shape.static final LevelBasedKeyProviderSupplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation. -
Constructor Summary
ConstructorsConstructorDescriptionDeepCuboidShape(net.minecraft.world.item.enchantment.LevelBasedValue heightWidthRadius, net.minecraft.world.item.enchantment.LevelBasedValue depthRadius) Creates an instance of aDeepCuboidShaperecord 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 caster, net.minecraft.world.phys.Vec3 epicenter, int enchantmentLevel) Computes the world-space axis-aligned bounding box enclosing the shape at the given epicenter.net.minecraft.world.item.enchantment.LevelBasedValueReturns the value of thedepthRadiusrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.net.minecraft.world.item.enchantment.LevelBasedValueReturns the value of theheightWidthRadiusrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
HEIGHT_WIDTH_RADIUS
JSON field key for the cross-sectional height/width half-extent.- See Also:
-
DEPTH_RADIUS
JSON field key for the longitudinal depth half-extent.- See Also:
-
KEY
-
KEY_PROVIDER
Supplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation. -
CODEC
MapCodec for serializing and deserializingDeepCuboidShapeinstances from JSON.
-
-
Constructor Details
-
DeepCuboidShape
public DeepCuboidShape(net.minecraft.world.item.enchantment.LevelBasedValue heightWidthRadius, net.minecraft.world.item.enchantment.LevelBasedValue depthRadius) Creates an instance of aDeepCuboidShaperecord class.- Parameters:
heightWidthRadius- the value for theheightWidthRadiusrecord componentdepthRadius- the value for thedepthRadiusrecord component
-
-
Method Details
-
computeBounds
public net.minecraft.world.phys.AABB computeBounds(net.minecraft.world.entity.Entity caster, 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:
caster- 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). -
heightWidthRadius
public net.minecraft.world.item.enchantment.LevelBasedValue heightWidthRadius()Returns the value of theheightWidthRadiusrecord component.- Returns:
- the value of the
heightWidthRadiusrecord component
-
depthRadius
public net.minecraft.world.item.enchantment.LevelBasedValue depthRadius()Returns the value of thedepthRadiusrecord component.- Returns:
- the value of the
depthRadiusrecord component
-