Fix ThrownPotion#splash NPE when called from API#13734
Closed
dreamy32 wants to merge 1 commit intoPaperMC:mainfrom
Closed
Fix ThrownPotion#splash NPE when called from API#13734dreamy32 wants to merge 1 commit intoPaperMC:mainfrom
dreamy32 wants to merge 1 commit intoPaperMC:mainfrom
Conversation
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
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? |
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.
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