private void dropItems(World world, int x, int y, int z)
    {
        Random random = new Random();

        TileEntity te = world.getTileEntity(x, y, z);
        if (!(te instanceof IInventory))
            return;

        IInventory inventory = (IInventory) te;

        for (int i = 0; i < inventory.getSizeInventory(); i++)
        {
            ItemStack stack = inventory.getStackInSlot(i);
            if (stack != null && stack.stackSize > 0)
            {
                float rx = random.nextFloat() * 0.8f + 0.1f;
                float ry = random.nextFloat() * 0.8f + 0.1f;
                float rz = random.nextFloat() * 0.8f + 0.1f;
                EntityItem droppedItem = new EntityItem(
                    world,
                    x + rx, y + ry, z + rz,
                    new ItemStack(stack.getItem(), stack.stackSize, stack.getItemDamage())
                );

                if (stack.hasTagCompound())
                    droppedItem.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy());

                droppedItem.motionX = random.nextGaussian() * 0.05f;
                droppedItem.motionY = random.nextGaussian() * 0.05f + 0.2f;
                droppedItem.motionZ = random.nextGaussian() * 0.05f;

                world.spawnEntityInWorld(droppedItem);
                stack.stackSize = 0;
            }
        }
    }