add expxorter tile..

This commit is contained in:
Raoul Van den Berge
2015-12-19 00:11:37 +01:00
parent 2f9bc96ee5
commit cfcb518ddd
4 changed files with 206 additions and 60 deletions

View File

@@ -50,31 +50,7 @@ public class TileStorageProxy extends TileMachine implements IStorageProvider, I
return;
}
int toGo = stack.stackSize;
for (int i = 0; i < inventory.getSizeInventory(); ++i) {
ItemStack slot = inventory.getStackInSlot(i);
if (slot == null) {
inventory.setInventorySlotContents(i, stack);
return;
} else if (InventoryUtils.compareStackNoQuantity(slot, stack)) {
int toAdd = toGo;
if (slot.stackSize + toAdd > slot.getMaxStackSize()) {
toAdd = slot.getMaxStackSize() - slot.stackSize;
}
slot.stackSize += toAdd;
toGo -= toAdd;
if (toGo == 0) {
return;
}
}
}
InventoryUtils.pushToInventory(inventory, stack);
}
@Override
@@ -116,29 +92,7 @@ public class TileStorageProxy extends TileMachine implements IStorageProvider, I
return false;
}
int toGo = stack.stackSize;
for (int i = 0; i < inventory.getSizeInventory(); ++i) {
ItemStack slot = inventory.getStackInSlot(i);
if (slot == null) {
return true;
} else if (InventoryUtils.compareStackNoQuantity(slot, stack)) {
int toAdd = toGo;
if (slot.stackSize + toAdd > slot.getMaxStackSize()) {
toAdd = slot.getMaxStackSize() - slot.stackSize;
}
toGo -= toAdd;
if (toGo == 0) {
break;
}
}
}
return toGo == 0;
return InventoryUtils.canPushToInventory(inventory, stack);
}
@Override