Class BlockRotationUtil

java.lang.Object
com.hypixel.hytale.server.core.universe.world.chunk.BlockRotationUtil

public class BlockRotationUtil extends Object
  • Constructor Details

    • BlockRotationUtil

      public BlockRotationUtil()
  • Method Details

    • getFlipped

      @Nullable public static RotationTuple getFlipped(@Nonnull RotationTuple blockRotation, @Nullable BlockFlipType flipType, @Nonnull Axis axis)
      Computes the flipped rotation for a block reflected across the given axis. For blocks with a BlockFlipType, uses a matrix-based approach: Build the rotation matrix M (Ry*Rx*Rz, matching the rendering convention) Reflect across the flip axis: negate the corresponding row of M Apply a local chirality correction (right-multiply by C) to convert the improper rotation back to a proper rotation Decompose back to Euler angles For blocks without a flip type, uses a direct Euler-angle flip.
    • getRotated

      @Nullable public static RotationTuple getRotated(@Nonnull RotationTuple blockRotation, @Nonnull Axis axis, Rotation rotation, @Nonnull VariantRotation variantRotation)
    • getFlippedFiller

      public static int getFlippedFiller(int filler, @Nonnull Axis axis, @Nonnull BlockBoundingBoxes.RotatedVariantBoxes from, @Nonnull BlockBoundingBoxes.RotatedVariantBoxes to)
      Computes the filler offset of a cell after the multi-cell block it belongs to is mirrored across axis.

      A multi-cell block stores every cell as an offset from its base cell, and the offsets a rotation allows come from the hitbox of that rotation. A mirror moves the base cell to the opposite end of the footprint, so the offsets are mirrored and then re-anchored: the mirrored footprint is aligned with the footprint of the flipped rotation, and each cell keeps its offset from that shared corner.

      Parameters:
      from - the footprint of the rotation the block had
      to - the footprint of the rotation the block has after the flip
    • getRotatedFiller

      public static int getRotatedFiller(int filler, @Nonnull Axis axis, Rotation rotation)
    • getRotatedFiller

      public static int getRotatedFiller(int filler, @Nonnull RotationTuple rotation)