Search in sources :

Example 1 with EnumHingePosition

use of net.minecraft.block.BlockDoor.EnumHingePosition in project BuildCraft by BuildCraft.

the class VanillaRotationHandlers method rotateDoor.

private static EnumActionResult rotateDoor(World world, BlockPos pos, IBlockState state, EnumFacing sideWrenched) {
    if (state.getBlock() instanceof BlockDoor) {
        // Just check to make sure we have the right block...
        EnumDoorHalf half = state.getValue(BlockDoor.HALF);
        if (half == EnumDoorHalf.UPPER) {
            EnumHingePosition hinge = state.getValue(BlockDoor.HINGE);
            if (hinge == EnumHingePosition.LEFT)
                hinge = EnumHingePosition.RIGHT;
            else
                hinge = EnumHingePosition.LEFT;
            world.setBlockState(pos, state.withProperty(BlockDoor.HINGE, hinge));
        } else {
            // Lower
            rotateOnce(world, pos, state, BlockDoor.FACING, ROTATE_HORIZONTAL);
        }
        return EnumActionResult.SUCCESS;
    }
    return EnumActionResult.PASS;
}
Also used : BlockDoor(net.minecraft.block.BlockDoor) EnumDoorHalf(net.minecraft.block.BlockDoor.EnumDoorHalf) EnumHingePosition(net.minecraft.block.BlockDoor.EnumHingePosition)

Aggregations

BlockDoor (net.minecraft.block.BlockDoor)1 EnumDoorHalf (net.minecraft.block.BlockDoor.EnumDoorHalf)1 EnumHingePosition (net.minecraft.block.BlockDoor.EnumHingePosition)1