Repository navigation
Conversation
Member
|
not totally sure about the fix... this mess with the death event and the use of item.... Currently exists two issues.
|
Author
|
Ok, so I think I get it now.Two separate things: the drops get collected before
So should I keep it like this (death waits till the item is done), or use a narrower fix, and leave the death event where it is? With a narrower fix, I'd still need to sort out the potion showing up in the drops, and whether the late bottle should just vanish like Vanilla or get fixed too. |
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.
MedalTVMinecraft20261003204553603-trim-1791056852011.mp4
Fixes #14338.
What was happening
When a player drank a fatal harming potion,
finishUsingItem()applied the potion effects before replacing the potion with a glass bottle. The fatal effect calleddie()immediately, so Paper processed the death while the potion was still in the player's hand. The potion could enter the death drops, then item completion could put the bottle into the inventory after death processing, leaving the wrong item state after respawn.The fix
During player item completion,
die()now saves the first damage source instead of processing death immediately. The potion's result is installed and item use is stopped before the saved death is processed. Afinallyblock also drains the saved source if completion exits exceptionally, so a lethal source is not left pending. Deaths outside this completion path are unchanged.Testing
I reproduced the issue with the original build and confirmed the fix with the new Paperclip build. I tested fatal main-hand potion use with both
keepInventorysettings, fatal offhand use, and normal nonfatal potion use. The tested inventory outcomes had no extra potion or bottle.I also ran patch application and rebuilding, the full Gradle build and check lifecycle, and built and launched the Paperclip jar. The final Gradle test report shows 10,066 tests, 0 failures, and 86 skipped.
Notes
Other consumables that cause death during completion use the same ordering. Damage caused by a plugin in the earlier
PlayerItemConsumeEventis outside the deferral. If item completion throws before it produces a replacement, death is still processed infinallyusing the inventory state at that point; the item's partial changes are not rolled back.AI-assisted tooling helped trace the lifecycle, refine the implementation, and run the build checks. I reviewed the final diff and performed the in-game tests listed above.