@Override
public void onCrateItemsModified(ItemStack changed) {
if (ignoreModifiedItems) return;
ItemIdentifier item = new ItemIdentifier(changed);
int amount = changed.stackSize;
MapData itemData = getMapData(item);
Queue<Integer> emptySlots = new LinkedList<Integer>();
for (int slot = 0; slot < tempContents.length; slot++) {
ItemStack stack = tempContents[slot];
if (stack == null) { emptySlots.add(slot); continue; }
if (!item.matches(stack)) continue;
amount -= modifyItemsInSlot(slot, stack, itemData, amount);
if (amount == 0) return;
}
while ((amount > 0) && (emptySlots.size() > 0))