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