Skip to content

ThrownPotion#splash causes a NPE #13611

@Samsuik

Description

@Samsuik

Stack trace

[17:26:04 WARN]: [TestPlugin] Entity task for TestPlugin v1.0-SNAPSHOT generated an exception
java.lang.NullPointerException: Cannot invoke "net.minecraft.world.phys.HitResult.getLocation()" because "hitResult" is null
	at net.minecraft.world.entity.projectile.throwableitemprojectile.ThrownSplashPotion.onHitAsPotion(ThrownSplashPotion.java:44) ~[paper-1.21.11.jar:1.21.11-110-c59990d]
	at net.minecraft.world.entity.projectile.throwableitemprojectile.AbstractThrownPotion.splash(AbstractThrownPotion.java:84) ~[paper-1.21.11.jar:1.21.11-110-c59990d]
	at org.bukkit.craftbukkit.entity.CraftThrownPotion.splash(CraftThrownPotion.java:50) ~[paper-1.21.11.jar:1.21.11-110-c59990d]
	at TestPlugin-1.0-SNAPSHOT.jar//me.samsuik.testPlugin.TestPlugin.lambda$thrownPotion$0(TestPlugin.java:20) ~[?:?]
	at io.papermc.paper.threadedregions.scheduler.FoliaEntityScheduler$EntityScheduledTask.accept(FoliaEntityScheduler.java:167) ~[paper-1.21.11.jar:?]
	at io.papermc.paper.threadedregions.scheduler.FoliaEntityScheduler$EntityScheduledTask.accept(FoliaEntityScheduler.java:114) ~[paper-1.21.11.jar:?]
	at io.papermc.paper.threadedregions.EntityScheduler.executeTick(EntityScheduler.java:235) ~[paper-1.21.11.jar:1.21.11-110-c59990d]
	at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1769) ~[paper-1.21.11.jar:1.21.11-110-c59990d]
	at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1616) ~[paper-1.21.11.jar:1.21.11-110-c59990d]
	at net.minecraft.server.dedicated.DedicatedServer.tickServer(DedicatedServer.java:427) ~[paper-1.21.11.jar:1.21.11-110-c59990d]
	at net.minecraft.server.MinecraftServer.processPacketsAndTick(MinecraftServer.java:1672) ~[paper-1.21.11.jar:1.21.11-110-c59990d]
	at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1340) ~[paper-1.21.11.jar:1.21.11-110-c59990d]
	at net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:388) ~[paper-1.21.11.jar:1.21.11-110-c59990d]
	at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]

Plugin and Datapack List

n/a

Actions to reproduce (if known)

@EventHandler
public void thrownPotion(final ProjectileLaunchEvent launchEvent) {
    final Entity entity = launchEvent.getEntity();
    if (entity instanceof ThrownPotion potion) {
        entity.getScheduler().runDelayed(this, task -> potion.splash(), null, 5);
    }
}

Calling the splash method on a thrown potion always results in a NPE.

Paper version

[17:27:34 INFO]: Checking version, please wait...
[17:27:34 INFO]: This server is running Paper version 1.21.11-110-main@c59990d (2026-02-06T11:11:01Z) (Implementing API version 1.21.11-R0.1-SNAPSHOT)
You are running the latest version
Previous version: 1.21.11-DEV-c549e31 (MC: 1.21.11)

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: acceptedDisputed bug is accepted as valid or Feature accepted as desired to be added.version: 1.21.11Game version 1.21.11

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions