fix: preserve item use across unrelated entity status notifications - #4053
Open
aibengineering wants to merge 3 commits into
Open
fix: preserve item use across unrelated entity status notifications#4053aibengineering wants to merge 3 commits into
aibengineering wants to merge 3 commits into
Conversation
Contributor
|
Tests more than 1.5x slower than master (durations are noisy, so this is informational): |
aibengineering
force-pushed
the
fix/item-use-entity-status
branch
from
September 5, 2026 09:44
58b3dcf to
cbdee5f
Compare
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.
An
entity_statusnotification does not necessarily end the bot's active item use. A nearby mob's hurt status currently clearsbot.usingHeldItem; after filtering foreign entities, the bot's own hurt and successful shield-block statuses still clear it. That can make callers believe a bow draw or shield use has already ended.This change checks both facts in the inventory handler:
Consumption completion still finishes the pending
consume()task. Explicit item deactivation remains effective. A successful shield block or hurt notification preserves the active-use flag.The real inventory-plugin regression runs in every supported CI version group. It covers foreign hurt/death/completion/shield-block notifications, own hurt/shield-block notifications, own death, and a successful consumption completion. The own hurt and shield-block cases both fail against the previous PR head on 1.21.4 and pass with this follow-up.
Validation:
bun node_modules/mocha/bin/mocha.js test/inventoryItemUseTest.js test/diggingDeathTest.js --exit: 228 passing, including 224 inventory cases across 28 supported versions.node node_modules/mocha/bin/mocha.js test/internalTest.js --grep '1.8.8v|1.21.4v' --exit: 54 passing, 4 version-dependent skips.