Skip to content

fix(entity): default an unsized actor's hitbox to 0.6 x 1.8, scaled - #69

Merged
notchyves merged 1 commit into
theselauraproject:mainfrom
NaySurGithub:fix/default-hitbox
Nov 6, 2026
Merged

notchyves merged 1 commit into
theselauraproject:mainfrom
NaySurGithub:fix/default-hitbox

Conversation

@NaySurGithub

Copy link
Copy Markdown
Contributor

Problem

On The Hive hub, the game NPCs ("Punch to play") can only be hit around the middle of their body. Punching the head does nothing.

A packet capture shows that those head hits never leave the client. There are ten animate (swingSource: attack) with no inventory_transaction attack after them: Perlin's raycast misses the NPC. Body hits on the same NPC (runtime id 1008) do send ItemUseOnEntity attacks.

Cause

The NPC is hivehub:game_sky_solo, with SCALE 1.75. The server sends no BOUNDINGBOX_WIDTH / BOUNDINGBOX_HEIGHT (metadata keys 53 / 54) for it. Other hub NPCs do (npc_store 0.6 × 2.6, npc_region 0.6 × 2.2, …) and were fine.

With no server box and no known collision box, EntityRenderer::HitBox fell back to {0.6, 1.0}, without applying the scale. The 1.75×-scaled model therefore had a 1-block-tall hit box.

What the vanilla client uses

The behaviour below comes from IDA on the Windows client 1.26.60.5:

  • 0x142EBA9A0 builds the default minecraft:collision_box description and writes 0x3FE666663F19999A into it, i.e. width 0.6, height 1.8.
  • Player::stopSleep (0x1402BE690) resets the player to the same pair (with eye height 1.62).

Change

EntityRenderer::HitBox: the last fallback is now 0.6 × 1.8, times the actor's scale, like the other branches of the function. For this NPC, that is 1.05 × 3.15.

Testing

  • macOS arm64 Release build.
  • Hive hub: punching the game NPC's head now opens it (tested in game).
  • Not verified in the binary: whether the vanilla client scales a default-sized box by SCALE. This follows the existing scaled branches.

An actor without server-sent BOUNDINGBOX_WIDTH/HEIGHT and without a known
collision box fell back to an unscaled 0.6 x 1.0 box. Large scaled NPCs
could then only be hit low on their body: aiming at the head sent no
attack at all. The game's minecraft:collision_box description defaults to
0.6 x 1.8 (0x142EBA9A0); the box now uses that, times the actor's scale
like the other cases.
@notchyves
notchyves merged commit 4525cee into theselauraproject:main Nov 6, 2026
8 of 10 checks passed
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