Contents
Class BreakShape
java.lang.Object
com.hypixel.hytale.server.core.modules.interaction.breakshape.BreakShape
- All Implemented Interfaces:
NetworkSerializable<BreakShape>
- Direct Known Subclasses:
BoxBreakShape, CylinderBreakShape
A tool's "shape of effect" for block breaking: a view-oriented, block-anchored region of blocks
(e.g. a pickaxe that breaks a 3x3 plane) that the break interaction expands the target into.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BuilderCodec<BreakShape> The base codec that allBreakShapes inherit from.static final CodecMapCodec<BreakShape> The codec that will decode to the correct break shape based on the providedIdfield.static final intThe maximum allowed value for any single dimension.static final intThe maximum allowed magnitude, per axis, for theoffset, keeping the shape near the reach-checked targeted block and the rounded offset withinintblock coordinates.static final intA cap on the bounding volume (Width * Height * Depth) to bound per-action work. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidforEachLocalOffset(TriIntConsumer consumer) Emits every block offset that makes up this shape, in shape-local coordinates(u, v, w)whereuis right,vis up andwis into the targeted surface.intgetDepth()intorg.joml.Vector3fintgetWidth()booleanvoidselectBlocks(CommandBuffer<EntityStore> commandBuffer, Ref<EntityStore> ref, org.joml.Vector3i anchorBlock, TriIntConsumer consumer) Finds every block this shape covers, anchored atanchorBlockand oriented to the user's view (or the targeted surface), and reports each toconsumer.Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface NetworkSerializable
toPacket
-
Field Details
-
MAX_DIMENSION
public static final int MAX_DIMENSIONThe maximum allowed value for any single dimension.- See Also:
-
MAX_TOTAL_CELLS
public static final int MAX_TOTAL_CELLSA cap on the bounding volume (Width * Height * Depth) to bound per-action work.- See Also:
-
MAX_OFFSET
public static final int MAX_OFFSETThe maximum allowed magnitude, per axis, for theoffset, keeping the shape near the reach-checked targeted block and the rounded offset withinintblock coordinates.- See Also:
-
CODEC
The codec that will decode to the correct break shape based on the providedIdfield.Shapes should
CodecMapCodec.register(String, Class, Codec)themselves to this codec. -
BASE_CODEC
The base codec that allBreakShapes inherit from.
-
-
Constructor Details
-
BreakShape
public BreakShape()
-
-
Method Details
-
getWidth
public int getWidth() -
getHeight
public int getHeight() -
getDepth
public int getDepth() -
isCentered
public boolean isCentered() -
getOffset
@Nonnull public org.joml.Vector3f getOffset() -
getOrientation
-
forEachLocalOffset
Emits every block offset that makes up this shape, in shape-local coordinates(u, v, w)whereuis right,vis up andwis into the targeted surface.This is the server's source of truth for the shape's footprint; the client preview mirrors it in
BreakShapeGeometry(the C# port must be kept in lockstep).- Parameters:
consumer- Called once per block offset with(u, v, w).
-
selectBlocks
public void selectBlocks(@Nonnull CommandBuffer<EntityStore> commandBuffer, @Nonnull Ref<EntityStore> ref, @Nullable org.joml.Vector3i anchorBlock, @Nonnull TriIntConsumer consumer) Finds every block this shape covers, anchored atanchorBlockand oriented to the user's view (or the targeted surface), and reports each toconsumer.The shape is centered on the anchor block; the offset can shift it off the anchor, so the anchor is only reported when the shape actually covers it.
- Parameters:
commandBuffer- TheCommandBuffer<EntityStore>for component access.ref- The entity the shape is for. View orientation is derived from it.anchorBlock- The block to center the shape on, ornullfor nothing to select.consumer- Called once per covered block with its world coordinates.
-