Skip to content
New issue

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

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

Already on GitHub? # to your account

Add contains method to FabricComponentMapBuilder #4446

Merged

Conversation

TheDeathlyCow
Copy link
Contributor

@TheDeathlyCow TheDeathlyCow commented Feb 16, 2025

A handful of components (such as minecraft:unbreakable ) work based on presence in the map - they do not store a boolean flag in the component. Using the get methods have the side effect of adding the component to the builder map. So, if one of the presence-based components tries to be checked using one of those methods, then it will add them to the map even if that is not the intention. This PR aims to address that by adding a simple contains method that does not add the component and has no side effects.

@modmuss50 modmuss50 added enhancement New feature or request last call If you care, make yourself heard right away! small change labels Feb 16, 2025
@modmuss50 modmuss50 added the merge me please Pull requests that are ready to merge label Feb 20, 2025
@modmuss50 modmuss50 merged commit ee91fa1 into FabricMC:1.21.4 Feb 20, 2025
4 checks passed
modmuss50 pushed a commit that referenced this pull request Feb 20, 2025
* add contains method

* fix javadoc checkstyle i think

(cherry picked from commit ee91fa1)
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request last call If you care, make yourself heard right away! merge me please Pull requests that are ready to merge small change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants