Java Code Examples for org.bukkit.block.BlockFace#WEST_NORTH_WEST

The following examples show how to use org.bukkit.block.BlockFace#WEST_NORTH_WEST . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CraftSkull.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
static BlockFace getBlockFace(byte rotation) {
    switch (rotation) {
        case 0:
            return BlockFace.NORTH;
        case 1:
            return BlockFace.NORTH_NORTH_EAST;
        case 2:
            return BlockFace.NORTH_EAST;
        case 3:
            return BlockFace.EAST_NORTH_EAST;
        case 4:
            return BlockFace.EAST;
        case 5:
            return BlockFace.EAST_SOUTH_EAST;
        case 6:
            return BlockFace.SOUTH_EAST;
        case 7:
            return BlockFace.SOUTH_SOUTH_EAST;
        case 8:
            return BlockFace.SOUTH;
        case 9:
            return BlockFace.SOUTH_SOUTH_WEST;
        case 10:
            return BlockFace.SOUTH_WEST;
        case 11:
            return BlockFace.WEST_SOUTH_WEST;
        case 12:
            return BlockFace.WEST;
        case 13:
            return BlockFace.WEST_NORTH_WEST;
        case 14:
            return BlockFace.NORTH_WEST;
        case 15:
            return BlockFace.NORTH_NORTH_WEST;
        default:
            throw new AssertionError(rotation);
    }
}
 
Example 2
Source File: CraftSkull.java    From Thermos with GNU General Public License v3.0 5 votes vote down vote up
static BlockFace getBlockFace(byte rotation) {
    switch (rotation % 16) {
        case 0:
            return BlockFace.NORTH;
        case 1:
            return BlockFace.NORTH_NORTH_EAST;
        case 2:
            return BlockFace.NORTH_EAST;
        case 3:
            return BlockFace.EAST_NORTH_EAST;
        case 4:
            return BlockFace.EAST;
        case 5:
            return BlockFace.EAST_SOUTH_EAST;
        case 6:
            return BlockFace.SOUTH_EAST;
        case 7:
            return BlockFace.SOUTH_SOUTH_EAST;
        case 8:
            return BlockFace.SOUTH;
        case 9:
            return BlockFace.SOUTH_SOUTH_WEST;
        case 10:
            return BlockFace.SOUTH_WEST;
        case 11:
            return BlockFace.WEST_SOUTH_WEST;
        case 12:
            return BlockFace.WEST;
        case 13:
            return BlockFace.WEST_NORTH_WEST;
        case 14:
            return BlockFace.NORTH_WEST;
        case 15:
            return BlockFace.NORTH_NORTH_WEST;
        default:
            throw new AssertionError(rotation);
    }
}
 
Example 3
Source File: Flags.java    From CardinalPGM with MIT License 5 votes vote down vote up
public static BlockFace yawToFace(float yaw) {
    BlockFace[] RADIAL = {
            BlockFace.NORTH, BlockFace.NORTH_NORTH_EAST, BlockFace.NORTH_EAST, BlockFace.EAST_NORTH_EAST,
            BlockFace.EAST, BlockFace.EAST_SOUTH_EAST, BlockFace.SOUTH_EAST, BlockFace.SOUTH_SOUTH_EAST,
            BlockFace.SOUTH, BlockFace.SOUTH_SOUTH_WEST, BlockFace.SOUTH_WEST, BlockFace.WEST_SOUTH_WEST,
            BlockFace.WEST, BlockFace.WEST_NORTH_WEST, BlockFace.NORTH_WEST, BlockFace.NORTH_NORTH_WEST
    };
    int i = Math.round((yaw + 360f)/ 22.5f);
    return RADIAL[(i + 8)% 16];
}
 
Example 4
Source File: Banner.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
public BlockFace getFacing() {
    byte data = getData();

    if (!isWallBanner()) {
        switch (data) {
            case 0x0:
                return BlockFace.SOUTH;

            case 0x1:
                return BlockFace.SOUTH_SOUTH_WEST;

            case 0x2:
                return BlockFace.SOUTH_WEST;

            case 0x3:
                return BlockFace.WEST_SOUTH_WEST;

            case 0x4:
                return BlockFace.WEST;

            case 0x5:
                return BlockFace.WEST_NORTH_WEST;

            case 0x6:
                return BlockFace.NORTH_WEST;

            case 0x7:
                return BlockFace.NORTH_NORTH_WEST;

            case 0x8:
                return BlockFace.NORTH;

            case 0x9:
                return BlockFace.NORTH_NORTH_EAST;

            case 0xA:
                return BlockFace.NORTH_EAST;

            case 0xB:
                return BlockFace.EAST_NORTH_EAST;

            case 0xC:
                return BlockFace.EAST;

            case 0xD:
                return BlockFace.EAST_SOUTH_EAST;

            case 0xE:
                return BlockFace.SOUTH_EAST;

            case 0xF:
                return BlockFace.SOUTH_SOUTH_EAST;
        }

        return null;
    } else {
        return getAttachedFace().getOppositeFace();
    }
}
 
Example 5
Source File: Sign.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Gets the direction that this sign is currently facing
 *
 * @return BlockFace indicating where this sign is facing
 */
public BlockFace getFacing() {
    byte data = getData();

    if (!isWallSign()) {
        switch (data) {
            case 0x0:
                return BlockFace.SOUTH;

            case 0x1:
                return BlockFace.SOUTH_SOUTH_WEST;

            case 0x2:
                return BlockFace.SOUTH_WEST;

            case 0x3:
                return BlockFace.WEST_SOUTH_WEST;

            case 0x4:
                return BlockFace.WEST;

            case 0x5:
                return BlockFace.WEST_NORTH_WEST;

            case 0x6:
                return BlockFace.NORTH_WEST;

            case 0x7:
                return BlockFace.NORTH_NORTH_WEST;

            case 0x8:
                return BlockFace.NORTH;

            case 0x9:
                return BlockFace.NORTH_NORTH_EAST;

            case 0xA:
                return BlockFace.NORTH_EAST;

            case 0xB:
                return BlockFace.EAST_NORTH_EAST;

            case 0xC:
                return BlockFace.EAST;

            case 0xD:
                return BlockFace.EAST_SOUTH_EAST;

            case 0xE:
                return BlockFace.SOUTH_EAST;

            case 0xF:
                return BlockFace.SOUTH_SOUTH_EAST;
        }

        return null;
    } else {
        return getAttachedFace().getOppositeFace();
    }
}