@SuppressWarnings("rawtypes") @Override public void addCollisionBoxesToList( World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) { int meta = getMetaFromState(state); if (meta == 2 || meta == 6) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.2F, 1.0F); super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); } else if (meta == 0 || meta == 4) { this.setBlockBounds( 0.3F, 0.0F, 0.3F, 0.7F, worldIn.getBlockState(pos.up()).getBlock() == this ? 1.0F : 0.6F, 0.7F); super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); } /*else if (meta == 7) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.38F, 1.0F); super.addCollisionBoxesToList(world, x, y, z, axisalignedbb, list, entity); }*/ else { super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); } }
@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); }
@Override public void onNeighborBlockChange( World world, BlockPos pos, IBlockState state, Block neighborBlock) { if (world.isAirBlock(pos.up())) { this.dropBlockAsItem(world, pos, state, 0); world.setBlockToAir(pos); } }
@Override public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) { int meta = getMetaFromState(worldIn.getBlockState(pos)); if (meta == 2 || meta == 6) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.2F, 1.0F); } else if (meta == 0 || meta == 4) { this.setBlockBounds( 0.3F, 0.0F, 0.3F, 0.7F, worldIn.getBlockState(pos.up()).getBlock() == this ? 1.0F : 0.6F, 0.7F); } else { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } }