Record Class WideCuboidShape
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.spellfield.shape.WideCuboidShape
- Record Components:
heightDepthRadius- TheLevelBasedValuehalf-extent along the vertical ($Y$) and forward horizontal axes.widthRadius- TheLevelBasedValuehalf-extent along the lateral horizontal axis perpendicular to the caster's facing.
- All Implemented Interfaces:
SpellFieldShape
public record WideCuboidShape(net.minecraft.world.item.enchantment.LevelBasedValue heightDepthRadius, net.minecraft.world.item.enchantment.LevelBasedValue widthRadius)
extends Record
implements SpellFieldShape
A horizontal orientation-aware cuboid
SpellFieldShape that applies widthRadius()
perpendicular to the caster's horizontal cardinal facing direction and heightDepthRadius()
along the vertical and forward axes (ideal for wide cleaves or walls).-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<WideCuboidShape> MapCodec for serializing and deserializingWideCuboidShapeinstances from JSON.static final StringJSON field key for the vertical and forward depth half-extent.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 lateral width half-extent. -
Constructor Summary
ConstructorsConstructorDescriptionWideCuboidShape(net.minecraft.world.item.enchantment.LevelBasedValue heightDepthRadius, net.minecraft.world.item.enchantment.LevelBasedValue widthRadius) Creates an instance of aWideCuboidShaperecord 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.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 theheightDepthRadiusrecord component.final StringtoString()Returns a string representation of this record class.net.minecraft.world.item.enchantment.LevelBasedValueReturns the value of thewidthRadiusrecord component.
-
Field Details
-
HEIGHT_DEPTH_RADIUS
JSON field key for the vertical and forward depth half-extent.- See Also:
-
WIDTH_RADIUS
JSON field key for the lateral width half-extent.- See Also:
-
KEY
Registry path identifier for this spell field shape.- See Also:
-
KEY_PROVIDER
Supplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation. -
CODEC
MapCodec for serializing and deserializingWideCuboidShapeinstances from JSON.
-
-
Constructor Details
-
WideCuboidShape
public WideCuboidShape(net.minecraft.world.item.enchantment.LevelBasedValue heightDepthRadius, net.minecraft.world.item.enchantment.LevelBasedValue widthRadius) Creates an instance of aWideCuboidShaperecord class.- Parameters:
heightDepthRadius- the value for theheightDepthRadiusrecord componentwidthRadius- the value for thewidthRadiusrecord 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
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). -
heightDepthRadius
public net.minecraft.world.item.enchantment.LevelBasedValue heightDepthRadius()Returns the value of theheightDepthRadiusrecord component.- Returns:
- the value of the
heightDepthRadiusrecord component
-
widthRadius
public net.minecraft.world.item.enchantment.LevelBasedValue widthRadius()Returns the value of thewidthRadiusrecord component.- Returns:
- the value of the
widthRadiusrecord component
-