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.
Description
Same as #3633 (I think I ported it fine)
This PR aims to fix an issue I created with item comparisons in #3419.
That PR made the comparison checks end up only working for EXACT matches. Really, I should've been using something like SAME_ITEM.
However, when I made my changes, it fixed an issue with comparing for unmodified items. You could do if player's tool is a diamond sword, but that would match ANY diamond sword. If you wanted to match to an unmodified diamond sword, you could do if player's tool is a diamond sword named "", but in the end, that feels kind of hacky.
To solve this issue, I've also added ExprPlain. The expression takes in an ItemType and returns an unmodified version that is tagged as plain through ItemData.
I've improved the metadata checks and comparators to properly use SAME_ITEM matches AND to handle the "new" plain items. I have also expanded and updated the current item comparison test accordingly.
I'm thinking some parts may be able to be improved, so any feedback is appreciated. While I tested this PR as best I could (through the test suite and in game), more rigorous in game testing would be beneficial.
Right now, I am going to target 2.5, but this PR very well may end up in 2.6.
Target Minecraft Versions: Any
Requirements: None
Related Issues: #3618