Skip to content

server/entity: fix a firework damaging players through walls - #1415

Open
schphe wants to merge 2 commits into
df-mc:masterfrom
oriumgames:fix/firework-damage-through-walls
Open

server/entity: fix a firework damaging players through walls#1415
schphe wants to merge 2 commits into
df-mc:masterfrom
oriumgames:fix/firework-damage-through-walls

Conversation

@schphe

@schphe schphe commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

What happens and why

The check for a clear line between an exploding firework and a victim treats
any hit as a clear line. trace.Perform reports a hit for the block it stopped
at as well as for an entity, so a wall between the two satisfied it and the
damage was dealt through the wall. Only a hit that is not a block counts now.

Verification

Reproduced in process: a firework exploding on the far side of a wall damages a player through it. trace.Perform reports a hit for the block it stopped at (server/block/cube/trace/result.go:32) as well as for an entity, so the guard that was meant to require a clear line accepted the wall as one.

No unit test: the fix is a type check on a result the surrounding code already has, and reaching it needs a firework entity, a victim and a wall in a live world.

@TwistedAsylumMC

Copy link
Copy Markdown
Member

I don't think the fix is quite right. Perform truncates the ray at the block it hits (end = hit.Position()) before it tests entities, so an entity standing between the firework and the wall still produces an EntityResult and the victim behind the wall takes damage anyway. Perform is the wrong tool here: it answers "what did this ray hit first", not "is there a block in between". Could this test block occlusion only, via TraverseBlocks/BlockIntercept? ExplosionConfig.exposure already does block-only line-of-sight for the same purpose, so there's a pattern to follow.

@schphe
schphe force-pushed the fix/firework-damage-through-walls branch 4 times, most recently from 7961341 to 1e8aeb4 Compare August 18, 2026 00:45
schphe and others added 2 commits August 20, 2026 02:47
The check for a clear line between an exploding firework and a victim treats
any hit as a clear line. trace.Perform reports a hit for the block it stopped
at as well as for an entity, so a wall between the two satisfied it and the
damage was dealt through the wall. Only a hit that is not a block counts now.
trace.Perform answers what a ray hits first, not whether a block is in
between: it overwrites the block it stopped at with any entity it
intercepts, so an entity standing in front of a wall let the damage
through it. Traverse the blocks instead, as ExplosionConfig.exposure
does.

Co-Authored-By: Claude <noreply@anthropic.com>
@schphe
schphe force-pushed the fix/firework-damage-through-walls branch from 1e8aeb4 to 8f523f3 Compare August 20, 2026 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants