Skip to content

Conversation

@Brokkonaut
Copy link
Contributor

Fix a crash when creating explosions with no power, this happens for example with the following code:

Fireball rocket = (Fireball) world.spawnEntity(spawnLoc, EntityType.FIREBALL);
rocket.setYield(0F);
rocket.setVelocity(something);

This code worked fine in paper 1.21.8 and I think there is no reason why it should not work.

If there is an entity (in the log below it is a projectile) nearby (less than 1 block distance to the explosion of the fireball) it would otherwise get a push with a NaN vector (in the code d is NaN -> d2 is NaN -> vec32 has NaN components) setting the entities velocity to NaN what crashes the server the next time that entity ticks.

Stacktrace without the fix is something like this:

[19:53:48] [Paper Watchdog Thread/ERROR]: The server has not responded for 65 seconds! Creating thread dump
[19:53:48] [Paper Watchdog Thread/ERROR]: ------------------------------
[19:53:48] [Paper Watchdog Thread/ERROR]: Server thread dump (Look for plugins here before reporting to Paper!):
[19:53:48] [Paper Watchdog Thread/ERROR]: ------------------------------
[19:53:48] [Paper Watchdog Thread/ERROR]: Current Thread: Server thread
[19:53:48] [Paper Watchdog Thread/ERROR]: 	PID: 53 | Suspended: false | Native: false | State: RUNNABLE
[19:53:48] [Paper Watchdog Thread/ERROR]: 	Stack:
[19:53:48] [Paper Watchdog Thread/ERROR]: 		net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase.getShape(BlockBehaviour.java:789)
[19:53:48] [Paper Watchdog Thread/ERROR]: 		net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase.getShape(BlockBehaviour.java:785)
[19:53:48] [Paper Watchdog Thread/ERROR]: 		net.minecraft.world.level.block.state.BlockBehaviour.getCollisionShape(BlockBehaviour.java:332)
[19:53:48] [Paper Watchdog Thread/ERROR]: 		net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase.getCollisionShape(BlockBehaviour.java:797)
[19:53:48] [Paper Watchdog Thread/ERROR]: 		net.minecraft.world.level.ClipContext$Block$$Lambda/0x00007f85a29ff6d8.get(Unknown Source)
[19:53:48] [Paper Watchdog Thread/ERROR]: 		net.minecraft.world.level.ClipContext$Block.get(ClipContext.java:91)
[19:53:48] [Paper Watchdog Thread/ERROR]: 		net.minecraft.world.level.ClipContext.getBlockShape(ClipContext.java:48)
[19:53:48] [Paper Watchdog Thread/ERROR]: 		net.minecraft.world.level.Level.fastClip(Level.java:443)
[19:53:48] [Paper Watchdog Thread/ERROR]: 		net.minecraft.world.level.Level.clip(Level.java:502)
[19:53:48] [Paper Watchdog Thread/ERROR]: 		net.minecraft.world.level.CollisionGetter.clipIncludingBorder(CollisionGetter.java:114)
[19:53:48] [Paper Watchdog Thread/ERROR]: 		net.minecraft.world.entity.projectile.ProjectileUtil.getHitResult(ProjectileUtil.java:49)
[19:53:48] [Paper Watchdog Thread/ERROR]: 		net.minecraft.world.entity.projectile.ProjectileUtil.getHitResultOnMoveVector(ProjectileUtil.java:28)
[19:53:48] [Paper Watchdog Thread/ERROR]: 		net.minecraft.world.entity.projectile.ThrowableProjectile.tick(ThrowableProjectile.java:50)
[19:53:48] [Paper Watchdog Thread/ERROR]: 		net.minecraft.server.level.ServerLevel.tickNonPassenger(ServerLevel.java:1316)
[19:53:48] [Paper Watchdog Thread/ERROR]: 		net.minecraft.server.level.ServerLevel$$Lambda/0x00007f85a28d76c8.accept(Unknown Source)
[19:53:48] [Paper Watchdog Thread/ERROR]: 		net.minecraft.world.level.Level.guardEntityTick(Level.java:1434)
[19:53:48] [Paper Watchdog Thread/ERROR]: 		net.minecraft.server.level.ServerLevel.lambda$tick$4(ServerLevel.java:839)
[19:53:48] [Paper Watchdog Thread/ERROR]: 		net.minecraft.server.level.ServerLevel$$Lambda/0x00007f85a27c6dd8.accept(Unknown Source)
[19:53:48] [Paper Watchdog Thread/ERROR]: 		net.minecraft.world.level.entity.EntityTickList.forEach(EntityTickList.java:39)
[19:53:48] [Paper Watchdog Thread/ERROR]: 		net.minecraft.server.level.ServerLevel.tick(ServerLevel.java:821)
[19:53:48] [Paper Watchdog Thread/ERROR]: 		net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1807)
[19:53:48] [Paper Watchdog Thread/ERROR]: 		net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1618)
[19:53:48] [Paper Watchdog Thread/ERROR]: 		net.minecraft.server.dedicated.DedicatedServer.tickServer(DedicatedServer.java:430)
[19:53:48] [Paper Watchdog Thread/ERROR]: 		net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1338)
[19:53:48] [Paper Watchdog Thread/ERROR]: 		net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:384)
[19:53:48] [Paper Watchdog Thread/ERROR]: 		net.minecraft.server.MinecraftServer$$Lambda/0x00007f85a0f32f48.run(Unknown Source)
[19:53:48] [Paper Watchdog Thread/ERROR]: 		[email protected]/java.lang.Thread.runWith(Thread.java:1596)
[19:53:48] [Paper Watchdog Thread/ERROR]: 		[email protected]/java.lang.Thread.run(Thread.java:1583)

The fix just skips the entity hurt logic when there is no explosion power

@Brokkonaut Brokkonaut requested a review from a team as a code owner November 23, 2025 04:24
@github-project-automation github-project-automation bot moved this to Awaiting review in Paper PR Queue Nov 23, 2025
@Owen1212055
Copy link
Member

This has been fixed in the snapshots, btw.

@Brokkonaut Brokkonaut closed this Nov 23, 2025
@github-project-automation github-project-automation bot moved this from Awaiting review to Closed in Paper PR Queue Nov 23, 2025
@Brokkonaut
Copy link
Contributor Author

ok thanks, i failed and made a feature patch, this was not indented. should i create a normal patch or just keep it brokenb until the next release?

@Owen1212055
Copy link
Member

Probably not worth it, esp with it being pre releases.

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.

2 participants