/** Call when a container block is broken to drop the entire inv into the world */ public static void dropContainerBlockInventory(World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); if (!(tileEntity instanceof IInventory)) { return; } IInventory inv = (IInventory) tileEntity; for (int i = 0; i < inv.getSizeInventory(); ++i) { spawnItemWithRandom(world, inv.getStackInSlotOnClosing(i), x, y, z); } }
@Override public ItemStack getStackInSlotOnClosing(int slot) { return inv.getStackInSlotOnClosing(start + slot); }