Search in sources :

Example 1 with TileEntityPressureChamberWall

use of me.desht.pneumaticcraft.common.tileentity.TileEntityPressureChamberWall in project pnc-repressurized by TeamPneumatic.

the class BlockPressureChamberWall method updateState.

public IBlockState updateState(IBlockState state, IBlockAccess world, BlockPos pos) {
    state = super.getExtendedState(state, world, pos);
    TileEntityPressureChamberWall wall = (TileEntityPressureChamberWall) world.getTileEntity(pos);
    EnumWallState wallState;
    if (wall != null) {
        TileEntityPressureChamberValve core = wall.getCore();
        if (core != null) {
            int x = pos.getX();
            int y = pos.getY();
            int z = pos.getZ();
            boolean xMin = x == core.multiBlockX;
            boolean yMin = y == core.multiBlockY;
            boolean zMin = z == core.multiBlockZ;
            boolean xMax = x == core.multiBlockX + core.multiBlockSize - 1;
            boolean yMax = y == core.multiBlockY + core.multiBlockSize - 1;
            boolean zMax = z == core.multiBlockZ + core.multiBlockSize - 1;
            // Corners
            if (xMin && yMin && zMin || xMax && yMax && zMax) {
                wallState = EnumWallState.XMIN_YMIN_ZMIN;
            } else if (xMin && yMin && zMax || xMax && yMax && zMin) {
                wallState = EnumWallState.XMIN_YMIN_ZMAX;
            } else if (xMin && yMax && zMax || xMax && yMin && zMin) {
                wallState = EnumWallState.XMIN_YMAX_ZMAX;
            } else if (xMin && yMax && zMin || xMax && yMin && zMax) {
                wallState = EnumWallState.XMIN_YMAX_ZMIN;
            } else // Edges
            if (yMin && xMin || yMax && xMax || yMin && xMax || yMax && xMin) {
                wallState = EnumWallState.XEDGE;
            } else if (yMin && zMin || yMax && zMax || yMin && zMax || yMax && zMin) {
                wallState = EnumWallState.ZEDGE;
            } else if (!yMin && !yMax) {
                if (xMin && zMin || xMax && zMax || xMin && zMax || xMax && zMin) {
                    wallState = EnumWallState.YEDGE;
                } else {
                    wallState = EnumWallState.CENTER;
                }
            } else {
                wallState = EnumWallState.CENTER;
            }
        } else {
            wallState = EnumWallState.NONE;
        }
    } else {
        wallState = EnumWallState.NONE;
    }
    state = state.withProperty(WALL_STATE, wallState);
    return state;
}
Also used : TileEntityPressureChamberValve(me.desht.pneumaticcraft.common.tileentity.TileEntityPressureChamberValve) TileEntityPressureChamberWall(me.desht.pneumaticcraft.common.tileentity.TileEntityPressureChamberWall)

Example 2 with TileEntityPressureChamberWall

use of me.desht.pneumaticcraft.common.tileentity.TileEntityPressureChamberWall in project pnc-repressurized by TeamPneumatic.

the class BlockPressureChamberWallBase method breakBlock.

@Override
public void breakBlock(World world, BlockPos pos, IBlockState state) {
    TileEntity te = world.getTileEntity(pos);
    if (te instanceof TileEntityPressureChamberWall && !world.isRemote) {
        ((TileEntityPressureChamberWall) te).onBlockBreak();
    }
    super.breakBlock(world, pos, state);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityPressureChamberWall(me.desht.pneumaticcraft.common.tileentity.TileEntityPressureChamberWall)

Aggregations

TileEntityPressureChamberWall (me.desht.pneumaticcraft.common.tileentity.TileEntityPressureChamberWall)2 TileEntityPressureChamberValve (me.desht.pneumaticcraft.common.tileentity.TileEntityPressureChamberValve)1 TileEntity (net.minecraft.tileentity.TileEntity)1