Search in sources :

Example 1 with TileEntityPhotoProcessor

use of com.porpit.minecamera.tileentity.TileEntityPhotoProcessor in project MineCamera by PorPit.

the class BlockPhotoProcessor method breakBlock.

@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
    TileEntityPhotoProcessor te = (TileEntityPhotoProcessor) worldIn.getTileEntity(pos);
    IItemHandler inv = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.UP);
    for (int i = inv.getSlots() - 1; i >= 0; --i) {
        if (inv.getStackInSlot(i) != null) {
            Block.spawnAsEntity(worldIn, pos, inv.getStackInSlot(i));
            ((IItemHandlerModifiable) inv).setStackInSlot(i, null);
        }
    }
    super.breakBlock(worldIn, pos, state);
}
Also used : IItemHandlerModifiable(net.minecraftforge.items.IItemHandlerModifiable) TileEntityPhotoProcessor(com.porpit.minecamera.tileentity.TileEntityPhotoProcessor) IItemHandler(net.minecraftforge.items.IItemHandler)

Aggregations

TileEntityPhotoProcessor (com.porpit.minecamera.tileentity.TileEntityPhotoProcessor)1 IItemHandler (net.minecraftforge.items.IItemHandler)1 IItemHandlerModifiable (net.minecraftforge.items.IItemHandlerModifiable)1