feat(attribute): add attribute api#331
Closed
killcerr wants to merge 11 commits into
Closed
Conversation
wu-vincent
added a commit
that referenced
this pull request
Jun 2, 2026
Builds on the rebased #331 to complete and correct the attribute API: - Move hasAttribute/getAttribute/getAttributes from Actor to Mob, matching Bukkit's Attributable (LivingEntity); non-living actors have no attribute map. - Reconstruct the bedrock AttributeInstance modifier math faithfully from BDS (addModifier/removeModifier/getModifiers, _calculateValue, _sanitizeValue) instead of the previous hand-rolled approximation. - AttributeModifier: keep it Bukkit-shaped (name/uuid/amount/operation); add the Bedrock-only `Cap` operation; drop the engine-internal operand (always CURRENT). - AttributeInstance: add getMinValue/getMaxValue, getModifier(uuid), removeModifier(uuid), and addTransientModifier() (Bukkit's transient-vs-persistent split, instead of a serializable flag on the modifier); drop getDefaultValue (no distinct default on Bedrock). - Wire Python bindings, stubs and tests to the above.
wu-vincent
added a commit
that referenced
this pull request
Jun 2, 2026
Builds on the rebased #331 to complete and correct the attribute API: - Move hasAttribute/getAttribute/getAttributes from Actor to Mob, matching Bukkit's Attributable (LivingEntity); non-living actors have no attribute map. - Reconstruct the bedrock AttributeInstance modifier math faithfully from BDS (addModifier/removeModifier/getModifiers, _calculateValue, _sanitizeValue) instead of the previous hand-rolled approximation. - AttributeModifier: keep it Bukkit-shaped (name/uuid/amount/operation); add the Bedrock-only `Cap` operation; drop the engine-internal operand (always CURRENT). - AttributeInstance: add getMinValue/getMaxValue, getModifier(uuid), removeModifier(uuid), and addTransientModifier() (Bukkit's transient-vs-persistent split, instead of a serializable flag on the modifier); drop getDefaultValue (no distinct default on Bedrock). - Wire Python bindings, stubs and tests to the above.
wu-vincent
added a commit
that referenced
this pull request
Jun 2, 2026
Builds on the rebased #331 to complete and correct the attribute API: - Move hasAttribute/getAttribute/getAttributes from Actor to Mob, matching Bukkit's Attributable (LivingEntity); non-living actors have no attribute map. - Reconstruct the bedrock AttributeInstance modifier math faithfully from BDS (addModifier/removeModifier/getModifiers, _calculateValue, _sanitizeValue) instead of the previous hand-rolled approximation. - AttributeModifier: identify modifiers by AttributeModifierId (a namespaced Identifier, the Endstone counterpart of Bukkit's NamespacedKey) rather than a UUID; the bedrock UUID is derived deterministically from the id. Add the Bedrock-only Cap operation; drop the engine-internal operand (always CURRENT). - AttributeInstance: add getMinValue/getMaxValue, getModifier(id), removeModifier(id), and addTransientModifier() (Bukkit's transient-vs-persistent split); drop getDefaultValue (no distinct default on Bedrock). - Wire Python bindings, stubs and tests to the above.
wu-vincent
added a commit
that referenced
this pull request
Jun 2, 2026
Builds on the rebased #331 to complete and correct the attribute API: - Move hasAttribute/getAttribute/getAttributes from Actor to Mob, matching Bukkit's Attributable (LivingEntity); non-living actors have no attribute map. - Reconstruct the bedrock AttributeInstance modifier math faithfully from BDS (addModifier/removeModifier/getModifiers, _calculateValue, _sanitizeValue) instead of the previous hand-rolled approximation. - AttributeModifier: identify modifiers by AttributeModifierId (a namespaced Identifier, the Endstone counterpart of Bukkit's NamespacedKey) rather than a UUID; the bedrock UUID is derived deterministically from the id. Add the Bedrock-only Cap operation; drop the engine-internal operand (always CURRENT). - AttributeInstance: add getMinValue/getMaxValue, getModifier(id), removeModifier(id), and addTransientModifier() (Bukkit's transient-vs-persistent split); drop getDefaultValue (no distinct default on Bedrock). - Wire Python bindings, stubs and tests to the above.
Member
wu-vincent
added a commit
that referenced
this pull request
Jun 2, 2026
* feat(attribute): add attribute API (rebased #331) Squashed rebase of #331 by killcerr onto develop, with conflicts resolved against develop's current API (as<T>() casting, ActorType getType(), Identifier-based ids). This is a work-in-progress base for finishing the attribute API; the design is reworked in follow-up commits. Co-authored-by: killcerr <kill_cerr@outlook.com> * feat(attribute): finish the attribute API Builds on the rebased #331 to complete and correct the attribute API: - Move hasAttribute/getAttribute/getAttributes from Actor to Mob, matching Bukkit's Attributable (LivingEntity); non-living actors have no attribute map. - Reconstruct the bedrock AttributeInstance modifier math faithfully from BDS (addModifier/removeModifier/getModifiers, _calculateValue, _sanitizeValue) instead of the previous hand-rolled approximation. - AttributeModifier: identify modifiers by AttributeModifierId (a namespaced Identifier, the Endstone counterpart of Bukkit's NamespacedKey) rather than a UUID; the bedrock UUID is derived deterministically from the id. Add the Bedrock-only Cap operation; drop the engine-internal operand (always CURRENT). - AttributeInstance: add getMinValue/getMaxValue, getModifier(id), removeModifier(id), and addTransientModifier() (Bukkit's transient-vs-persistent split); drop getDefaultValue (no distinct default on Bedrock). - Wire Python bindings, stubs and tests to the above. * feat(attribute): allow setting an attribute's min and max value Add setMinValue/setMaxValue to AttributeInstance (Bedrock-specific, no Bukkit equivalent), so plugins can raise an attribute's cap - e.g. the maximum of minecraft:player.hunger or minecraft:health. Mirrors the existing getMinValue/ getMaxValue getters and the bedrock setMinValue/setMaxValue already used by Mob.setMaxHealth. --------- Co-authored-by: killcerr <kill_cerr@outlook.com>
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.
fix #293