if (item == null || item.stackSize <= 0)
{
return;
}
TileEntityLandmine tileEntity = (TileEntityLandmine) par1World.getTileEntity(x, y, z);
while (item.stackSize > 0)
{
boolean hasRemovedThisIteration = false;
for (int i = 0; i < tileEntity.getSizeTriggerInventory(); i++)
{
if (!hasRemovedThisIteration && tileEntity.getStackInSlot(i) != null)
{
if (tileEntity.getStackInSlot(i).isItemEqual(item))
{
tileEntity.decrStackSize(i, 1);
item.stackSize--;
}
}
if (!hasRemovedThisIteration && i == tileEntity.getSizeTriggerInventory() - 1)
{
item.stackSize--;
}
}
}