mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-25 14:24:42 +00:00
Fix bug in implementation of tryAddStack
This commit is contained in:
1 parent
3e9da9b85c
commit
0b6b201366
1 file changed
+7
-5
@@ -459,12 +459,14 @@ public abstract class InventoryUtil {
|
||||
}
|
||||
|
||||
public static boolean tryAddStack(IInventory inventory, ItemStack stack, int startSlot, int slots, boolean all, boolean doAdd) {
|
||||
int added = addStack(inventory, stack, startSlot, slots, doAdd);
|
||||
if (all) {
|
||||
return added == stack.stackSize;
|
||||
} else {
|
||||
return added > 0;
|
||||
int added = addStack(inventory, stack, startSlot, slots, false);
|
||||
boolean success = all ? (added == stack.stackSize) : (added > 0);
|
||||
|
||||
if (success && doAdd) {
|
||||
addStack(inventory, stack, startSlot, slots, true);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
public static int addStack(IInventory inventory, ItemStack stack, boolean doAdd) {
|
||||
|
||||
Reference in new issue
Block a user