if(chest.getKey() == getDirectionFacing())
{
continue;
}
IInventoryManager inventory = InventoryManager.create(chest.getValue(), chest.getKey());
Map<Integer, ItemStack> contents = inventory.getContents();
for(Entry<Integer, ItemStack> stack : contents.entrySet())
{
if(stack == null || stack.getValue() == null)
{
continue;
}
if(chest.getValue() instanceof ISidedInventory)
{
ISidedInventory sided = (ISidedInventory)chest.getValue();
if(!sided.canExtractItem(stack.getKey(), stack.getValue(), chest.getKey().ordinal()))
{
continue;
}
}
ItemStack stackToDrop = stack.getValue().copy();
stackToDrop.stackSize = 1;
ItemStack remaining = UtilInventory.dropStack(this, stackToDrop, this.getDirectionFacing(), this.getDirectionFacing());
// remaining == null if dropped successfully.
if(remaining == null)
{
inventory.removeItem(1, stackToDrop);
break inv;
}
}
}
}