Fixed addition to generic inventories.
This commit is contained in:
parent
b8ed333b73
commit
372d090a67
2 changed files with 20 additions and 13 deletions
|
@ -93,6 +93,7 @@ public class StackUtil {
|
|||
if(used <= 0)
|
||||
return false;
|
||||
|
||||
if(add)
|
||||
items.stackSize -= used;
|
||||
return true;
|
||||
}
|
||||
|
@ -143,11 +144,13 @@ public class StackUtil {
|
|||
if (added)
|
||||
if (!add)
|
||||
return true;
|
||||
else if (items.stackSize - itemsAdded == 0)
|
||||
return true;
|
||||
else {
|
||||
items.stackSize -= itemsAdded;
|
||||
itemsAdded = 0;
|
||||
if (items.stackSize == 0)
|
||||
return true;
|
||||
else
|
||||
checkAvailableSlot(inventory, added, from);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -186,6 +189,7 @@ public class StackUtil {
|
|||
} else {
|
||||
// This is a generic inventory
|
||||
IInventory inv = Utils.getInventory(inventory);
|
||||
System.out.println("Adding to generic inventory.");
|
||||
|
||||
for (int j = 0; j < inv.getSizeInventory(); ++j)
|
||||
if (tryAdding(inv, j, add, true)) {
|
||||
|
@ -195,13 +199,15 @@ public class StackUtil {
|
|||
}
|
||||
|
||||
// If the inventory if full, return false
|
||||
|
||||
if (added) {
|
||||
if (!add)
|
||||
return true;
|
||||
else if (items.stackSize - itemsAdded == 0)
|
||||
return true;
|
||||
else {
|
||||
items.stackSize -= itemsAdded;
|
||||
itemsAdded = 0;
|
||||
if (items.stackSize == 0)
|
||||
return true;
|
||||
else
|
||||
checkAvailableSlot(inventory, added, from);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -128,8 +128,9 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor {
|
|||
* on the position of the pipe.
|
||||
*/
|
||||
public ItemStack[] checkExtract(IInventory inventory, boolean doRemove, Orientations from) {
|
||||
|
||||
/// ISPECIALINVENTORY
|
||||
if (inventory instanceof ISpecialInventory)
|
||||
// TAKE INTO ACCOUNT SPECIAL INVENTORIES!!!
|
||||
return ((ISpecialInventory) inventory).extractItem(doRemove, from, 1);
|
||||
|
||||
if (inventory instanceof ISidedInventory) {
|
||||
|
|
Loading…
Reference in a new issue