Skip to content

scaling new baby mob entities down on older clients#1268

Open
mfishma wants to merge 1 commit into
ViaVersion:masterfrom
mfishma:feature/scale-new-babies-v2
Open

scaling new baby mob entities down on older clients#1268
mfishma wants to merge 1 commit into
ViaVersion:masterfrom
mfishma:feature/scale-new-babies-v2

Conversation

@mfishma
Copy link
Copy Markdown
Contributor

@mfishma mfishma commented May 28, 2026

Resubmitting for feature request #1058

I gave another go of the baby mob scaling, it was much easier using the SharedRegistrations system, and as discussed, minimized impact by making sure to use the filter by type framework to just check for registered mobs (Happy Ghast, Squids, Dolphin). I tied the packet injection strictly to state-changes, unlike the previous PR that more globally hooked to UPDATE_ATTRIBUTES. So, this should really minimize overhead on the network thread.

I still felt this was important, for the Ghastling's hitbox, both for jumping on, and matching the server physics, because when one flies to the player with a snowball, it currently has this jittery rubber-banding interaction where the client thinks the 4x4x4 version is pushing the player away, but the server has to reset them back.

Changes

  • New EntityScaleHelper in api/entities -- a dedicated listener for the metadata, rather than a global packet hook.

  • Updated protocol rewriters to explicitly register the entities we care about & their scale factors.

  • When the baby metadata is seen, the helper calculates the scale, compares it to the tracked EntityScaleData, and dynamically injects an UPDATE_ATTRIBUTES packet into the pipeline to shrink the mob.

  • Also added cancel(16), hard-coded that because it's a known Ghast attribute, in EntityPacketRewriter1_21_6 for the Happy Ghast so older clients don't keep showing the Ghast's "is attacking" fireball face.

    I know the preference is to attach attributes during SPAWN_ENTITY. But the baby state of these mobs is entirely dictated by the isBaby metadata (e.g., index 16 for HGs). Because SPAWN_ENTITY doesn't have metadata, I couldn't find a way to know its baby state until its first ENTITY_DATA packet. Injecting the attribute update at the exact moment the metadata is parsed seemed like the most non-intrusive way to guarantee the scale applies.

Manual testing

  • Paper 1.21.11 Server:
    • Connected with 1.21.5 client and verified Happy Ghast baby scaling works perfectly via the new metadata injection.
    • Connected with 1.20.5 client and verified Squids & Dolphin scaling behaves flawlessly.
    • Hitboxes correctly shrink to match the server physics, completely eliminating the rubber-banding interaction desyncs.
    • Ghastlings don't have the fireball face.
2026-05-27_09 39 30 2026-02-25_04 16 56

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.

1 participant