Ejemplo n.º 1
0
  @Override
  public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
    EnumBlockMultiType type = (EnumBlockMultiType) state.getValue(MULTI_TYPE);
    int renderType = 0;

    switch (type) {
      case CRYO_CHAMBER:
        IBlockState stateAbove = worldIn.getBlockState(pos.up());
        TileEntityMulti tile = (TileEntityMulti) worldIn.getTileEntity(pos);
        if (stateAbove.getBlock() == this
            && (stateAbove.getValue(MULTI_TYPE)) == EnumBlockMultiType.CRYO_CHAMBER) {
          renderType = 0;
        } else {
          renderType = 4;
        }
        if (tile != null && tile.mainBlockPosition != null) {
          IBlockState stateMain = worldIn.getBlockState(tile.mainBlockPosition);
          if (stateMain.getBlock() == MarsBlocks.machine
              && stateMain.getValue(BlockMachineMars.TYPE)
                  == BlockMachineMars.EnumMachineType.CRYOGENIC_CHAMBER) {
            EnumFacing dir = stateMain.getValue(BlockMachineMars.FACING);
            renderType += dir.getHorizontalIndex();
          }
        }
        break;
      default:
        break;
    }

    return state.withProperty(RENDER_TYPE, renderType);
  }