Class DirectionHelpers

java.lang.Object
org.cyclops.cyclopscore.helper.DirectionHelpers

public class DirectionHelpers extends Object
This class contains helper methods involving directions.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static List<net.minecraft.core.Direction>
    A list of all the Direction.
    static net.minecraft.core.Direction[][]
    A double array that contains the visual side.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Iterator<net.minecraft.core.Direction>
    Get an iterator for all the Direction.
    static net.minecraft.core.Direction
    getEntityFacingDirection(net.minecraft.world.entity.LivingEntity entity)
    Get the EnumFacing the entity is facing, only vertical directions.
    static net.minecraft.core.Direction
    Get the Direction from the sign of an X offset.
    static net.minecraft.core.Direction
    Get the Direction from the sign of an Z offset.
    static net.minecraft.core.Direction
    transformFacingForRotation(net.minecraft.core.Direction facing, net.minecraft.core.Direction rotation)
    Transform the given facing based on a rotation.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DIRECTIONS

      public static List<net.minecraft.core.Direction> DIRECTIONS
      A list of all the Direction.
    • TEXTURESIDE_ORIENTATION

      public static net.minecraft.core.Direction[][] TEXTURESIDE_ORIENTATION
      A double array that contains the visual side. The first argument should be the rotation of the blockState and the second argument is the side for which the texture is called.
  • Constructor Details

    • DirectionHelpers

      public DirectionHelpers()
  • Method Details

    • getDirectionIterator

      public static Iterator<net.minecraft.core.Direction> getDirectionIterator()
      Get an iterator for all the Direction.
      Returns:
      The Direction iterator
      See Also:
    • getEntityFacingDirection

      public static net.minecraft.core.Direction getEntityFacingDirection(net.minecraft.world.entity.LivingEntity entity)
      Get the EnumFacing the entity is facing, only vertical directions.
      Parameters:
      entity - The entity that is facing a direction.
      Returns:
      The Direction the entity is facing.
    • getEnumFacingFromXSign

      public static net.minecraft.core.Direction getEnumFacingFromXSign(int xSign)
      Get the Direction from the sign of an X offset.
      Parameters:
      xSign - X offset from somewhere.
      Returns:
      The Direction for the offset.
    • getEnumFacingFromZSing

      public static net.minecraft.core.Direction getEnumFacingFromZSing(int zSign)
      Get the Direction from the sign of an Z offset.
      Parameters:
      zSign - Z offset from somewhere.
      Returns:
      The Direction for the offset.
    • transformFacingForRotation

      public static net.minecraft.core.Direction transformFacingForRotation(net.minecraft.core.Direction facing, net.minecraft.core.Direction rotation)
      Transform the given facing based on a rotation. The default rotation is Direction.NORTH, which means no transformation.
      Parameters:
      facing - The facing to transform.
      rotation - The rotation.
      Returns:
      The transformed facing.