Fix ItemStack Matcher #362
Merged
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 fixes the logic behind ingredient matching of an ItemStack that contains a
matcher: e.g. one that had eitherwhenNoNbtorwhenAnyNbtcalled on it.The previous logic led to some serious downfalls. As an example, consider the recipe
The previous logic causes success as long as the stack matches item/meta, thus the no nbt condition is ignored. Furthermore, if we place one item in, the recipe instantly triggers, ignoring the requirement of the second book, for if the matcher is set, as long as the matcher returns valid (which only checks tag), then the logic causes success.
This PR fixes this, making sure both item stack item/meta and matcher are checked. The changes were checked with a matcher set (e.g. above recipe) and ingredients in recipes without matchers set.