#4132·mineflayer

getExplosionDamages uses player dimensions for every entity

Author: XalzerophCreated Sep 18, 2026Updated Sep 18, 2026
Labelspossible bugStage1

Versions

  • mineflayer: master (4.39.0)
  • node: 24.21.0

Detailed description of a problem

getExplosionDamages accepts an Entity, but calcExposure in lib/plugins/explosion.js always samples a 0.6 x 1.8 bounding box.

This makes explosion damage depend on player dimensions even when the target is a mob or another entity with a different bounding box. With the same position and a raycast that blocks rays whose normalized Y component is above 0.3, a 0.4 x 0.7 entity and a 0.6 x 1.8 entity produce different exposure values, but the current implementation treats them identically.

The entity objects created by lib/plugins/entities.js already carry width and height, so those values can be used by the exposure sampler. Falling back to the current player dimensions keeps the behavior safe for entities that do not provide either field.

What did you try yet?

I reproduced this with a small world.raycast stub and added a regression test. The test fails with the current implementation because both entities receive the same damage.

Expected behavior

The exposure calculation should use the target entity's bounding-box dimensions.

Additional context

I have prepared a patch and regression test in a fork. The pull request will be linked after this issue is created.