Skip to content

Fix ThrownPotion#splash NPE when called from API#13734

Closed
dreamy32 wants to merge 1 commit intoPaperMC:mainfrom
dreamy32:fix/splash-npe
Closed

Fix ThrownPotion#splash NPE when called from API#13734
dreamy32 wants to merge 1 commit intoPaperMC:mainfrom
dreamy32:fix/splash-npe

Conversation

@dreamy32
Copy link
Copy Markdown

Calling ThrownPotion#splash() from a plugin always throws a NPE because CraftThrownPotion passes null as the HitResult, and onHitAsPotion tries to call getLocation() on it.

Fixed by defaulting to a BlockHitResult at the entity's position when the result is null, so the splash area is just centered on the potion itself which makes sense for programmatic calls.

Fixes #13611

splash(null) is passed from CraftThrownPotion when plugins call
the method programmatically, but onHitAsPotion tries to call
getLocation() on the result which blows up. default to the
entity's own position so the splash area is centered on the potion.

fixes PaperMC#13611
@dreamy32 dreamy32 requested a review from a team as a code owner March 30, 2026 17:16
@github-project-automation github-project-automation bot moved this to Awaiting review in Paper PR Queue Mar 30, 2026
@Warriorrrr
Copy link
Copy Markdown
Member

There is already another PR open that fixes the linked issue, do you think this would be a better solution than the other PR?

@dreamy32 dreamy32 closed this Mar 30, 2026
@github-project-automation github-project-automation bot moved this from Awaiting review to Closed in Paper PR Queue Mar 30, 2026
@dreamy32 dreamy32 deleted the fix/splash-npe branch March 30, 2026 18:54
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.

ThrownPotion#splash causes a NPE

2 participants