Class DirectionTransformationUtil

java.lang.Object
alexiil.mc.lib.multipart.api.misc.DirectionTransformationUtil

public final class DirectionTransformationUtil extends Object
A handful of utilities for working with DirectionTransformations.
  • Method Details

    • getRotation

      @Nullable public static BlockRotation getRotation(DirectionTransformation transformation)
      Gets the equivalent BlockRotation for a given DirectionTransformation if any.
      Parameters:
      transformation - The transformation to try and turn into a BlockRotation.
      Returns:
      The BlockRotation equivalent to the given transformation or null if the given transformation has no equivalent BlockRotation.
    • getMirror

      @Nullable public static BlockMirror getMirror(DirectionTransformation transformation)
      Gets the equivalent BlockMirror for a given DirectionTransformation if any.
      Parameters:
      transformation - The transformation to try and turn into a BlockMirror.
      Returns:
      The BlockMirror equivalent to the given transformation or null if the given transformation has no equivalent BlockMirror.
    • isRotationOrMirror

      public static boolean isRotationOrMirror(DirectionTransformation transformation)
      Determines whether a DirectionTransformation can be represented as either a BlockRotation or BlockMirror.
    • getRelativeTransformation

      public static DirectionTransformation getRelativeTransformation(DirectionTransformation base, DirectionTransformation newTransformation)
      Gets the relative transformation that would need to be prepended to the base transformation to obtain the new transformation.
      Parameters:
      base - The transformation we're relativizing the new transformation in relation to.
      newTransformation - The transformation we're turning into a relative transformation.
      Returns:
      A relative transformation that could be prepended to base to obtain newTransformation.