Sophisticated Core

Sophisticated Core

49M Downloads

[Suggestion] Handling By-products from Consuming Stacked Foods

ookasamoti opened this issue ยท 0 comments

commented

When consuming stacked foods that have by-products, such as stews, in conjunction with the Feeding Upgrade, the handling of these by-products isn't working as expected. The by-products, such as bowls or glass bottles, do not get stored correctly in the containerItem of FeedingUpgradeWrapper.tryFeedingFoodFromStorage and always end up in the player's inventory directly.

I propose to set the stack count to 1 before consuming the food, and after the by-product is correctly stored in the containerItem, modify the stack count of the food to the number -1.

int stackCount = stack.getCount();
stack.setCount(1);

...

if(stackCount ! = 1){ //Food measures not targeted for consumption (e.g.artifacts:eternal_steak)
    stack.setCount(stackCount - 1); // Adjust the stack count to reflect the consumed item
}

Apologies if there have been any translation errors or rudeness.