Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement item matchers #1055

Merged
merged 1 commit into from
Sep 23, 2022
Merged

Implement item matchers #1055

merged 1 commit into from
Sep 23, 2022

Conversation

Pablete1234
Copy link
Member

@Pablete1234 Pablete1234 commented Sep 13, 2022

Change item filters like holding, carrying and wearing with ItemMatchers. Item matchers are a more generic way of matching items, supporting checking ignoring metadata, or amount ranges.

Prior to this, item matching was always exact meta, always ignoring durability, and "at least X" amount matching, this is the default behavior if no extra flags are specified.

Examples:

<holding amount="[3,6]" ignore-durability="false" ignore-metadata="true">
  <item material="wool" damage="0"/>
</holding>

This will match if you're holding between 3 and 6 (inclusive) white wool, ignoring any other metadata (eg: enchantments, renaming, can-place-on, etc).

<holding ignore-enchantments="true">
  <item material="wool" amount="5"/>
</holding>

This will match at least 5 wool (legacy behavior) of any durability (any color) (legacy behavior), and matching exact metadata (eg: name, can-place-on, etc), but will ignore enchantments.

The new available properties are: ignore-durability (default true), ignore-metadata (default false), ignore-name (default ignore-meta), ignore-enchantments (default to ignore-meta).
If ignore-metadata is set to true, ignore-name and ignore-enchantments cannot be false.

@Pablete1234 Pablete1234 added the feature New feature or request label Sep 13, 2022
Signed-off-by: Pablete1234 <[email protected]>
@Pablete1234
Copy link
Member Author

Update: rebased ontop of dev

Copy link
Member

@Electroid Electroid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay! 🎉 LGTM

@Electroid Electroid merged commit cd0f3c4 into dev Sep 23, 2022
@Electroid Electroid deleted the item-matchers branch September 23, 2022 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Development

Successfully merging this pull request may close these issues.

2 participants