Compacting drawer item duplication fix for 1.16#1017
Merged
Conversation
This was referenced Apr 24, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR is a 1.16 backport fix for the item duplication bug outlined in issue #1009. The 1.18 version of the fix will be located in this PR: #1016 (though the actual code chages are the same).
The bug happens after fully taking out items from a compacting drawer and then putting in a different item, which takes up less slots in the drawer (has less compacting variants).
For example, a drawer stored iron blocks, ingots and nuggets. Player takes out all of them (the drawer becomes empty) and puts in clay. Clay has only 2 compacting variants as opposed to iron's 3 - clay blocks and clay balls. This is when the error happens - the cached value for the 3rd drawer doesn't get reset and still holds iron nuggets. However, the bug isn't noticeable yet, as all the slots are currently being built from scratch and the cache is untouched.
Problems start when you fully take out clay and put it in again. This time, the input item matches the cached value, so slots get loaded from the cache in their entirety, resulting in a drawer with clay blocks, clay balls and iron ingots.
The fix makes sure that all remaining slots get reset instead of ending the loop early.
Additionaly, some minor changes were made to build.gradle to make sure that the project loads properly.