Skip to content

Improved Attribute Handling with New Attributable Interface Methods#12461

Closed
xcutiboo wants to merge 1 commit into
PaperMC:mainfrom
xcutiboo:iiXXiXii
Closed

Improved Attribute Handling with New Attributable Interface Methods#12461
xcutiboo wants to merge 1 commit into
PaperMC:mainfrom
xcutiboo:iiXXiXii

Conversation

@xcutiboo
Copy link
Copy Markdown

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

@xcutiboo xcutiboo requested a review from a team as a code owner April 20, 2025 08:58
@github-project-automation github-project-automation Bot moved this to Awaiting review in Paper PR Queue Apr 20, 2025
@masmc05
Copy link
Copy Markdown
Contributor

masmc05 commented Apr 20, 2025

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.

@lynxplay
Copy link
Copy Markdown
Contributor

The PR seems to not add anything useful that isn't already present on the AttributeInstance.
Additionally you seem to have random changes to the particle builder.
We will not be pulling this, thank you for your PR!

@lynxplay lynxplay closed this Apr 20, 2025
@github-project-automation github-project-automation Bot moved this from Awaiting review to Closed in Paper PR Queue Apr 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Closed

Development

Successfully merging this pull request may close these issues.

3 participants