Search in sources :

Example 1 with IInventoryProvider

use of icbm.classic.prefab.inventory.IInventoryProvider in project ICBM-Classic by BuiltBrokenModding.

the class BlockICBM method breakBlock.

@Override
public void breakBlock(World world, BlockPos pos, IBlockState state) {
    TileEntity tile = world.getTileEntity(pos);
    if (tile instanceof IInventoryProvider && ((IInventoryProvider) tile).getInventory() != null) {
        InventoryHelper.dropInventoryItems(world, pos, ((IInventoryProvider) tile).getInventory());
    }
    if (tile instanceof IMultiTileHost) {
        // At this point the structure should already be dead if broken by a player
        MultiBlockHelper.destroyMultiBlockStructure((IMultiTileHost) tile, false, true, false);
    }
    super.breakBlock(world, pos, state);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) IMultiTileHost(icbm.classic.api.tile.multiblock.IMultiTileHost) IInventoryProvider(icbm.classic.prefab.inventory.IInventoryProvider)

Aggregations

IMultiTileHost (icbm.classic.api.tile.multiblock.IMultiTileHost)1 IInventoryProvider (icbm.classic.prefab.inventory.IInventoryProvider)1 TileEntity (net.minecraft.tileentity.TileEntity)1