001package net.minecraft.util;
002
003public class Direction
004{
005    public static final int[] offsetX = new int[] {0, -1, 0, 1};
006    public static final int[] offsetZ = new int[] {1, 0, -1, 0};
007    public static final String[] directions = new String[] {"SOUTH", "WEST", "NORTH", "EAST"};
008
009    /** Maps a Direction value (2D) to a Facing value (3D). */
010    public static final int[] directionToFacing = new int[] {3, 4, 2, 5};
011
012    /** Maps a Facing value (3D) to a Direction value (2D). */
013    public static final int[] facingToDirection = new int[] { -1, -1, 2, 0, 1, 3};
014
015    /** Maps a direction to that opposite of it. */
016    public static final int[] rotateOpposite = new int[] {2, 3, 0, 1};
017
018    /** Maps a direction to that to the right of it. */
019    public static final int[] rotateRight = new int[] {1, 2, 3, 0};
020
021    /** Maps a direction to that to the left of it. */
022    public static final int[] rotateLeft = new int[] {3, 0, 1, 2};
023    public static final int[][] bedDirection = new int[][] {{1, 0, 3, 2, 5, 4}, {1, 0, 5, 4, 2, 3}, {1, 0, 2, 3, 4, 5}, {1, 0, 4, 5, 3, 2}};
024
025    /**
026     * Returns the movement direction from a velocity vector.
027     */
028    public static int getMovementDirection(double par0, double par2)
029    {
030        return MathHelper.abs((float)par0) > MathHelper.abs((float)par2) ? (par0 > 0.0D ? 1 : 3) : (par2 > 0.0D ? 2 : 0);
031    }
032}