importer / exporter should respect sided inventories

This commit is contained in:
Raoul Van den Berge
2015-12-19 12:11:00 +01:00
parent 68a4656f22
commit fd787c0d0f
3 changed files with 91 additions and 6 deletions

View File

@@ -88,6 +88,30 @@ public class InventoryUtils {
}
}
public static void pushToInventorySlot(IInventory inventory, int i, ItemStack stack) {
ItemStack slot = inventory.getStackInSlot(i);
if (slot == null) {
inventory.setInventorySlotContents(i, stack);
} else if (compareStackNoQuantity(slot, stack)) {
slot.stackSize += stack.stackSize;
}
}
public static boolean canPushToInventorySlot(IInventory inventory, int i, ItemStack stack) {
ItemStack slot = inventory.getStackInSlot(i);
if (slot == null) {
return true;
}
if (!compareStackNoQuantity(slot, stack)) {
return false;
}
return slot.stackSize + stack.stackSize < slot.getMaxStackSize();
}
public static void pushToInventory(IInventory inventory, ItemStack stack) {
int toGo = stack.stackSize;