Class BreakShape

java.lang.Object
com.hypixel.hytale.server.core.modules.interaction.breakshape.BreakShape
All Implemented Interfaces:
NetworkSerializable<BreakShape>
Direct Known Subclasses:
BoxBreakShape, CylinderBreakShape

public abstract class BreakShape extends Object implements NetworkSerializable<BreakShape>
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 Details

    • MAX_DIMENSION

      public static final int MAX_DIMENSION
      The maximum allowed value for any single dimension.
      See Also:
    • MAX_TOTAL_CELLS

      public static final int MAX_TOTAL_CELLS
      A cap on the bounding volume (Width * Height * Depth) to bound per-action work.
      See Also:
    • MAX_OFFSET

      public static final int MAX_OFFSET
      The maximum allowed magnitude, per axis, for the offset, keeping the shape near the reach-checked targeted block and the rounded offset within int block coordinates.
      See Also:
    • CODEC

      @Nonnull public static final CodecMapCodec<BreakShape> CODEC
      The codec that will decode to the correct break shape based on the provided Id field.

      Shapes should CodecMapCodec.register(String, Class, Codec) themselves to this codec.

    • BASE_CODEC

      @Nonnull public static final BuilderCodec<BreakShape> BASE_CODEC
      The base codec that all BreakShapes 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

      @Nonnull public BreakShapeOrientation getOrientation()
    • forEachLocalOffset

      public abstract void forEachLocalOffset(@Nonnull TriIntConsumer consumer)
      Emits every block offset that makes up this shape, in shape-local coordinates (u, v, w) where u is right, v is up and w is 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 at anchorBlock and oriented to the user's view (or the targeted surface), and reports each to consumer.

      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 - The CommandBuffer<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, or null for nothing to select.
      consumer - Called once per covered block with its world coordinates.