Fix Quantum Chest voiding items near maximum capacity #1724
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What:
This PR fixes an issue where the quantum chest would void items when near maximum capacity in certain situations.
This fix is done by preventing returning early when trying to insert more items than the available remaining space, resulting in the item merge actually proceeding.
This bug was produced using the following conditions:
Give yourself a quantum chest full of iron ingots using the command
/give @p gregtech:machine 1 1010 {ItemAmount: 4096064L, ItemStack: {id: "minecraft:iron_ingot", Count: 1, Damage: 0}}
Place the chest and place a fluid solidifier (best at EV for the speed) next to the chest and set its auto output into the chest and enable the auto output.
Build up a backstock of iron in output slot of the solidifier, and fluid iron in the tank of the solidifier.
Remove half a stack of iron from the quantum chest by right clicking on the stack of iron in the output slot.
See the chest refill itself from its internal inventory and from the fluid solidifier, however see that it never reaches its maximum stored amount and continuously drains iron from the fluid solidifier output, voiding the excess iron and newly created iron.
How solved:
Not returning early allows the merge to actually succeed and properly update the inventory, which prevent this issue. And also returns the correct remaining itemstack from the partial merge from the output slot of the fluid solidifier.
Outcome:
Fixes the Quantum Chest voiding items inserted into it in some cases when near/at maximum capacity.
Possible compatibility issue:
None expected.