[PR #7827] A shulker hanging below a block grows taller as its lid opens #7845

Open
opened 2026-11-03 07:25:13 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7827
Author: @MSedgeMC
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: fix/shulker-peek-dims


📝 Commits (3)

  • fb0807b fix: a shulker hanging below a block grows taller as its lid opens
  • 7dbed3b test: an open shell under a block is 1 x 1.5 with its eyes at 0.75
  • abd607f port_map: Shulker.getDefaultDimensions points at the peek scale

📊 Changes

3 files changed (+70 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/mobs/living.rs (+7 -0)
📝 crates/horizon-client/src/mobs/shulker.rs (+62 -0)
📝 tools/port_map/game2-002.tsv (+1 -1)

📄 Description

Vanilla

Shulker.getDefaultDimensions(Pose) (javap -p -c -constants -cp /tmp/cj net.minecraft.world.entity.monster.Shulker) asks AbstractGolem.getDefaultDimensions(pose) — the type's box times getAgeScale — and then, only when the shell hangs from the block above and its lid has started to open:

 6: aload_0
 7: invokevirtual #228  // getAttachFace:()Lnet/minecraft/core/Direction;
10: getstatic     #327  // Field net/minecraft/core/Direction.DOWN
13: if_acmpne     39
16: aload_0
17: getfield      #296  // Field currentPeekAmount:F
20: fconst_0
21: fcmpl
22: ifle          39
25: fconst_1
26: aload_0
27: getfield      #296  // currentPeekAmount
30: fadd
31: fstore_3
32: aload_2
33: fconst_1
34: fload_3
35: invokevirtual #330  // EntityDimensions.scale:(FF)
38: areturn

EntityDimensions.scale(float, float) multiplies the width by the first factor and both the height and the eye height by the second (29: getfield width; fload_1; fmul, 35: getfield height; fload_2; fmul, 41: getfield eyeHeight; fload_2; fmul), so the box of a shell under a block is 1 x (1 + peek) — the width never changes — and at a fully open lid (peek 1.0) it is twice as tall with its eyes twice as high. EntityTypes.SHULKER is sized(1.0F, 1.0F).eyeHeight(0.5F), so that is 1 x 2 with the eyes at 1.0.

currentPeekAmount is the field the client itself advances: Shulker.tick calls updatePeekAmount and, when it reports a change, onPeekAmountChange, which ends in refreshDimensions(). updatePeekAmount targets getRawPeekAmount() * 0.01F (the synced byte, 0..100) and moves currentPeekAmount by Mth.clamp(current +- 0.05F, ...) a tick.

Horizon

Mob::awake_dims_in had arms for the sleeping villager, the sniffer digging, the goat's long jump, a sitting camel, the warden digging, a puffed pufferfish, the phantom and slime sizes — none for the shulker. The module already kept everything the arm needs: anim.v[PEEK] is currentPeekAmount, eased by ease_peek in both shulker::tick and shulker::client_tick, and extra.variant3 is the attach face, 0 for Direction.DOWN. Shulker.getDefaultDimensions was recorded as inline at shulker::progress_aabb with "the down-face height scale is not seen here".

A shulker firing at a player, or idling with its lid open, therefore kept a 1 x 1 box: its hitbox, its eye position and its culling range all stayed at the closed size while the model stood half again as tall.

The box now goes through shulker::peek_height_scale, the same 1 + anim.v[PEEK] factor, applied last in awake_dims_in over every other arm — the position vanilla applies it in.

Proven:

  • cargo test -q -p horizon-client-lib --lib shulker: 7 passed; 0 failed.
  • With the new arm removed, an_open_shell_hanging_below_a_block_stands_taller fails with the values the fix supplies: a half open shell is 1 x 1.5 with its eyes at 0.75: 1 x 1 x 0.5 (ten client ticks of Shulker.tick's 0.05: peek 0.5).
  • only_a_shell_hanging_below_a_block_grows keeps the other five attach faces at 1 x 1 x 0.5 with the lid fully open and a closed shell at 1 x 1 (it passes either way: it pins the direction gate).
  • cargo test -q -p horizon-client-lib --lib: 1429 passed; 0 failed; 48 ignored.
  • cargo clippy -q -p horizon-client-lib --lib is silent; rustfmt --edition 2024 --check on both files is clean.

Not proven:

  • No in-game check that a peeking shulker's click box matches its lid; the unit test pins Mob::dims, Mob::height and the eye height only.
  • Horizon computes dimensions on demand, so the refreshDimensions half of onPeekAmountChange has nothing to do here; the client never reaches the fudgePositionAfterSizeChange branch either (refreshDimensions guards it with !level().isClientSide), so a growing box is not expected to move the shell.
  • Shulker.makeBoundingBox uses getProgressAabb rather than the dimensions box, so the entity's own AABB is a separate port and is unchanged here.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/7827 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/shulker-peek-dims` --- ### 📝 Commits (3) - [`fb0807b`](https://github.com/horizon-rust/horizon/commit/fb0807bfc3bd2557cd148eb16f192dd2a722e966) fix: a shulker hanging below a block grows taller as its lid opens - [`7dbed3b`](https://github.com/horizon-rust/horizon/commit/7dbed3b22ee28eae2e50d96637c927dffdf6b129) test: an open shell under a block is 1 x 1.5 with its eyes at 0.75 - [`abd607f`](https://github.com/horizon-rust/horizon/commit/abd607f028e3dfefdac66170af321d542a33aedb) port_map: Shulker.getDefaultDimensions points at the peek scale ### 📊 Changes **3 files changed** (+70 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mobs/living.rs` (+7 -0) 📝 `crates/horizon-client/src/mobs/shulker.rs` (+62 -0) 📝 `tools/port_map/game2-002.tsv` (+1 -1) </details> ### 📄 Description ### Vanilla `Shulker.getDefaultDimensions(Pose)` (`javap -p -c -constants -cp /tmp/cj net.minecraft.world.entity.monster.Shulker`) asks `AbstractGolem.getDefaultDimensions(pose)` — the type's box times `getAgeScale` — and then, only when the shell hangs from the block above and its lid has started to open: ``` 6: aload_0 7: invokevirtual #228 // getAttachFace:()Lnet/minecraft/core/Direction; 10: getstatic #327 // Field net/minecraft/core/Direction.DOWN 13: if_acmpne 39 16: aload_0 17: getfield #296 // Field currentPeekAmount:F 20: fconst_0 21: fcmpl 22: ifle 39 25: fconst_1 26: aload_0 27: getfield #296 // currentPeekAmount 30: fadd 31: fstore_3 32: aload_2 33: fconst_1 34: fload_3 35: invokevirtual #330 // EntityDimensions.scale:(FF) 38: areturn ``` `EntityDimensions.scale(float, float)` multiplies the width by the first factor and **both the height and the eye height** by the second (`29: getfield width; fload_1; fmul`, `35: getfield height; fload_2; fmul`, `41: getfield eyeHeight; fload_2; fmul`), so the box of a shell under a block is `1 x (1 + peek)` — the width never changes — and at a fully open lid (peek 1.0) it is twice as tall with its eyes twice as high. `EntityTypes.SHULKER` is `sized(1.0F, 1.0F).eyeHeight(0.5F)`, so that is 1 x 2 with the eyes at 1.0. `currentPeekAmount` is the field the client itself advances: `Shulker.tick` calls `updatePeekAmount` and, when it reports a change, `onPeekAmountChange`, which ends in `refreshDimensions()`. `updatePeekAmount` targets `getRawPeekAmount() * 0.01F` (the synced byte, 0..100) and moves `currentPeekAmount` by `Mth.clamp(current +- 0.05F, ...)` a tick. ### Horizon `Mob::awake_dims_in` had arms for the sleeping villager, the sniffer digging, the goat's long jump, a sitting camel, the warden digging, a puffed pufferfish, the phantom and slime sizes — none for the shulker. The module already kept everything the arm needs: `anim.v[PEEK]` is `currentPeekAmount`, eased by `ease_peek` in both `shulker::tick` and `shulker::client_tick`, and `extra.variant3` is the attach face, 0 for `Direction.DOWN`. `Shulker.getDefaultDimensions` was recorded as `inline` at `shulker::progress_aabb` with "the down-face height scale is not seen here". A shulker firing at a player, or idling with its lid open, therefore kept a 1 x 1 box: its hitbox, its eye position and its culling range all stayed at the closed size while the model stood half again as tall. The box now goes through `shulker::peek_height_scale`, the same `1 + anim.v[PEEK]` factor, applied last in `awake_dims_in` over every other arm — the position vanilla applies it in. **Proven:** - `cargo test -q -p horizon-client-lib --lib shulker`: `7 passed; 0 failed`. - With the new arm removed, `an_open_shell_hanging_below_a_block_stands_taller` fails with the values the fix supplies: `a half open shell is 1 x 1.5 with its eyes at 0.75: 1 x 1 x 0.5` (ten client ticks of `Shulker.tick`'s 0.05: peek 0.5). - `only_a_shell_hanging_below_a_block_grows` keeps the other five attach faces at 1 x 1 x 0.5 with the lid fully open and a closed shell at 1 x 1 (it passes either way: it pins the direction gate). - `cargo test -q -p horizon-client-lib --lib`: `1429 passed; 0 failed; 48 ignored`. - `cargo clippy -q -p horizon-client-lib --lib` is silent; `rustfmt --edition 2024 --check` on both files is clean. **Not proven:** - No in-game check that a peeking shulker's click box matches its lid; the unit test pins `Mob::dims`, `Mob::height` and the eye height only. - Horizon computes dimensions on demand, so the `refreshDimensions` half of `onPeekAmountChange` has nothing to do here; the client never reaches the `fudgePositionAfterSizeChange` branch either (`refreshDimensions` guards it with `!level().isClientSide`), so a growing box is not expected to move the shell. - `Shulker.makeBoundingBox` uses `getProgressAabb` rather than the dimensions box, so the entity's own AABB is a separate port and is unchanged here. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#7845
No description provided.