Java Code Examples for net.minecraft.util.Direction#SOUTH

The following examples show how to use net.minecraft.util.Direction#SOUTH . 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: RotationUtils.java    From CodeChickenLib with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Rotate this Facing around all axises counter-clockwise (NORTH => SOUTH => EAST => WEST => UP => DOWN => NORTH)
 *
 * @param facing Current facing.
 * @return Next facing.
 */
public static Direction rotateForward(Direction facing) {
    switch (facing) {
        case NORTH:
            return Direction.DOWN;
        case DOWN:
            return Direction.UP;
        case UP:
            return Direction.WEST;
        case WEST:
            return Direction.EAST;
        case EAST:
            return Direction.SOUTH;
        case SOUTH:
            return Direction.NORTH;
    }
    return Direction.NORTH;
}
 
Example 2
Source File: RotationUtils.java    From CodeChickenLib with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Rotate this Facing around all axises counter-clockwise (NORTH => DOWN => UP => WEST => EAST => SOUTH => NORTH)
 *
 * @param facing Current facing.
 * @return Next facing.
 */
public static Direction rotateBackwards(Direction facing) {
    switch (facing) {
        case NORTH:
            return Direction.SOUTH;
        case SOUTH:
            return Direction.EAST;
        case EAST:
            return Direction.WEST;
        case WEST:
            return Direction.UP;
        case UP:
            return Direction.DOWN;
        case DOWN:
            return Direction.NORTH;
    }
    return Direction.NORTH;
}
 
Example 3
Source File: VectorUtils.java    From CodeChickenLib with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Calculates the EnumFacing for a given normal.
 *
 * @param normal The normal to calculate from.
 * @return The direction the normal is facing.
 */
public static Direction calcNormalSide(Vector3 normal) {
    if (normal.y <= -0.99) {
        return Direction.DOWN;
    }
    if (normal.y >= 0.99) {
        return Direction.UP;
    }
    if (normal.z <= -0.99) {
        return Direction.NORTH;
    }
    if (normal.z >= 0.99) {
        return Direction.SOUTH;
    }
    if (normal.x <= -0.99) {
        return Direction.WEST;
    }
    if (normal.x >= 0.99) {
        return Direction.EAST;
    }
    return null;
}
 
Example 4
Source File: CustomParticleHandler.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
@OnlyIn (Dist.CLIENT)
public static void addBlockHitEffects(World world, Cuboid6 bounds, Direction side, TextureAtlasSprite icon, ParticleManager particleManager) {
    float border = 0.1F;
    Vector3 diff = bounds.max.copy().subtract(bounds.min).add(-2 * border);
    diff.x *= world.rand.nextDouble();
    diff.y *= world.rand.nextDouble();
    diff.z *= world.rand.nextDouble();
    Vector3 pos = diff.add(bounds.min).add(border);

    if (side == Direction.DOWN) {
        diff.y = bounds.min.y - border;
    }
    if (side == Direction.UP) {
        diff.y = bounds.max.y + border;
    }
    if (side == Direction.NORTH) {
        diff.z = bounds.min.z - border;
    }
    if (side == Direction.SOUTH) {
        diff.z = bounds.max.z + border;
    }
    if (side == Direction.WEST) {
        diff.x = bounds.min.x - border;
    }
    if (side == Direction.EAST) {
        diff.x = bounds.max.x + border;
    }

    particleManager.addEffect(new CustomBreakingParticle(world, pos.x, pos.y, pos.z, 0, 0, 0, icon).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
}
 
Example 5
Source File: RotationUtils.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Rotate this Facing around the Y axis counter-clockwise (NORTH => WEST => SOUTH => EAST => NORTH)
 *
 * @param facing Current facing.
 * @return Next facing.
 */
public static Direction rotateCounterClockwise(Direction facing) {
    switch (facing) {
        case NORTH:
            return Direction.WEST;
        case EAST:
            return Direction.NORTH;
        case SOUTH:
            return Direction.EAST;
        case WEST:
            return Direction.SOUTH;
        default:
            throw new IllegalStateException("Unable to get CCW facing of " + facing);
    }
}
 
Example 6
Source File: RotationUtils.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Rotate this Facing around the Y axis counter-clockwise (NORTH => EAST => SOUTH => WEST => NORTH)
 *
 * @param facing Current facing.
 * @return Next facing.
 */
public static Direction rotateClockwise(Direction facing) {
    switch (facing) {
        case NORTH:
            return Direction.EAST;
        case EAST:
            return Direction.SOUTH;
        case SOUTH:
            return Direction.WEST;
        case WEST:
            return Direction.NORTH;
        default:
            throw new IllegalStateException("Unable to get CW facing of " + facing);
    }
}
 
Example 7
Source File: RotationUtils.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Turns Entity rotation in to Direction.
 *
 * @param rotation The entity rotation, Generally MathHelper.floor_double((entity.rotationYaw * 4F) / 360F + 0.5D) & 3;
 * @return The rotation in Direction.
 */
public static Direction entityRotationToSide(int rotation) {
    switch (rotation) {
        case 0:
            return Direction.SOUTH;
        case 1:
            return Direction.WEST;
        case 2:
            return Direction.NORTH;
        default:
            return Direction.EAST;
    }
}