Skip to content

Commit 8b32844

Browse files
committed
Only allow modifyFoodStackSize to decrease stack size
* Fix for unstackable things like mushroom soup having their stacksize changed * Fixes #57
1 parent 3708079 commit 8b32844

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/main/java/iguanaman/hungeroverhaul/util/ItemTweaks.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,22 @@ else if (Loader.isModLoaded("harvestcraft") && IguanaConfig.addSaplingTradesFarm
6969

7070
public static void modifyStackSize(Item item, ItemStack stack, FoodValues values)
7171
{
72+
int curStackSize = item.getItemStackLimit(stack);
73+
int newStackSize = curStackSize;
74+
7275
if (values.hunger <= 2)
73-
item.setMaxStackSize(16 * IguanaConfig.foodStackSizeMultiplier);
76+
newStackSize = 16 * IguanaConfig.foodStackSizeMultiplier;
7477
else if (values.hunger <= 5)
75-
item.setMaxStackSize(8 * IguanaConfig.foodStackSizeMultiplier);
78+
newStackSize = 8 * IguanaConfig.foodStackSizeMultiplier;
7679
else if (values.hunger <= 8)
77-
item.setMaxStackSize(4 * IguanaConfig.foodStackSizeMultiplier);
80+
newStackSize = 4 * IguanaConfig.foodStackSizeMultiplier;
7881
else if (values.hunger <= 11)
79-
item.setMaxStackSize(2 * IguanaConfig.foodStackSizeMultiplier);
82+
newStackSize = 2 * IguanaConfig.foodStackSizeMultiplier;
8083
else
81-
item.setMaxStackSize(IguanaConfig.foodStackSizeMultiplier);
84+
newStackSize = IguanaConfig.foodStackSizeMultiplier;
85+
86+
if (curStackSize > newStackSize)
87+
item.setMaxStackSize(newStackSize);
8288
}
8389

8490
public static void addButcherTrade(Item item, ItemStack stack, FoodValues values)

0 commit comments

Comments
 (0)