Improved Attribute Handling with New Attributable Interface Methods#12461
Closed
xcutiboo wants to merge 1 commit into
Closed
Improved Attribute Handling with New Attributable Interface Methods#12461xcutiboo wants to merge 1 commit into
xcutiboo wants to merge 1 commit into
Conversation
Contributor
|
I think you forgot to add the implementation of the added methods. Also did you want to include the ParticleBuilder changes? You didn't include those in your pr description. |
Contributor
|
The PR seems to not add anything useful that isn't already present on the AttributeInstance. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 pull request enhances the Attributable interface in Attributable.java by introducing a set of useful new methods for managing and interacting with attributes more effectively. These additions make it easier to check if an attribute exists, access all registered attributes, and work with both their base and final values.
Here's what's new:
Check if an attribute exists:
The new hasAttribute(@NotNull Attribute attribute) method lets you verify whether a specific attribute is currently registered.
Access all registered attributes:
The getAttributes() method returns a collection of all attributes currently registered to the object.
Manage base values of attributes:
getBaseValue(@NotNull Attribute attribute) retrieves the base value of a given attribute. If the attribute isn't registered, it returns 0 by default.
setBaseValue(@NotNull Attribute attribute, double value) sets the base value of a given attribute, and throws an exception if the attribute isn't registered.
Get final computed value of an attribute:
The getValue(@NotNull Attribute attribute) method calculates the final value of an attribute, taking all modifiers into account. If the attribute isn't registered, it also returns 0 by default