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
Adds a literal for itemtypes representing any item, all items, and any item in a tag.
The literal uses
simplify()
on ExprTag to allow tag expressions with literal strings to be interpreted as literals. This allows the use in events, like:This literal also allows things like
if player's tool is any item named "test" with lore "hello world"
, which makes item comparisons easier.In the process of implementing this, I discovered that the parser doesn't attempt to parse Literals that are registered as expressions when only the PARSE_LITERALS flag is active. I've included a basic fix in this draft but will be improving it (so as to not duplicate code)
I also have concerns about evaluating the tag contents at parse time, since the tag contents may change after that. This may require storing the key to the tag instead and evaluating it when the itemtype itself is evaluated. This isn't ideal but may be necessary.
TODO:
any item
return value so it doesn't show as simplyair
?give any item to me
to work properly.any item
itemtype so it compares against any amount of item if not specified.Target Minecraft Versions: any
Requirements: none
Related Issues: none