[PR #3557] [MERGED] Invisible mobs cast no shadow #5048

Closed
opened 2026-11-03 05:09:52 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3557
Author: @d3grando
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: fix-3289


📝 Commits (1)

  • 4245540 Invisible mobs cast no shadow

📊 Changes

3 files changed (+45 additions, -8 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+2 -5)
📝 crates/horizon-client/src/mobs.rs (+7 -2)
📝 crates/horizon-client/src/shadows.rs (+36 -1)

📄 Description

🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando themselves.

What and why

Fixes #3289

A mob with Invisibility had no model but still left its round shadow on the ground. The shadow pass in game.rs took every mob in self.mobs and never looked at invisibility.

The shadow casters now come from shadows::mob_casters, which leaves out invisible mobs. Mob::is_invisible is the new check (Entity.isInvisible). A mob counts as invisible when it has the shared flag 0x20 that a server sends (invisible, the default server-thread path and multiplayer) or the Invisibility effect on a mob the window ticks itself (--in-frame). Dropped items and experience orbs are unchanged.

Vanilla reference

  • EntityRenderer.extractRenderState: state.isInvisible = entity.isInvisible().
  • EntityRenderer.extractShadow: only builds shadow pieces when options.entityShadows is on and !state.isInvisible. Otherwise the shadow radius stays 0 and nothing is drawn.

No parity harness covers entity shadows. A unit test in shadows.rs checks this instead.

Self-check

tools/pr_ready.py was not run (Windows). These are the commands I ran:

cargo fmt --all -- --check                                              # ok
cargo clippy -p horizon-client --features mods --all-targets -- -D warnings   # ok
cargo test -p horizon-client --lib shadows::                            # 3 passed

The new test shadows::tests::invisible_mobs_cast_no_shadow uses three mobs: one visible, one with the server's invisible flag, and one with the Invisibility effect. Only the visible one may cast a shadow.

Before the fix (filter removed from mob_casters):

test shadows::tests::invisible_mobs_cast_no_shadow ... FAILED
assertion `left == right` failed: only the visible mob casts a shadow
  left: [(DVec3(0.5, 64.0, 1.0), "minecraft:cow"), (DVec3(0.0, 0.0, 0.0), "minecraft:cow"), (DVec3(0.0, 0.0, 0.0), "minecraft:cow")]
 right: [(DVec3(0.5, 64.0, 1.0), "minecraft:cow")]
test result: FAILED. 2 passed; 1 failed

After:

test shadows::tests::invisible_mobs_cast_no_shadow ... ok
test shadows::tests::vanilla_radii ... ok
test shadows::tests::shadows_lie_on_the_block_top_under_model_feet ... ok
test result: ok. 3 passed; 0 failed

In game

Two NoAI pigs stand on a concrete platform. The right one has /effect give @e[tag=inv] minecraft:invisibility infinite 0 true.

  • Before (v0.2.97): the invisible pig's shadow is still on the ground.
  • After (server thread, the default): no shadow under the invisible pig.
  • After /effect clear: its shadow comes back.
  • After with --in-frame: no shadow either.

🤖 Generated with Claude Code


🔄 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/3557 **Author:** [@d3grando](https://github.com/d3grando) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix-3289` --- ### 📝 Commits (1) - [`4245540`](https://github.com/horizon-rust/horizon/commit/424554071192e03dd362646f60abb8a75134cc48) Invisible mobs cast no shadow ### 📊 Changes **3 files changed** (+45 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+2 -5) 📝 `crates/horizon-client/src/mobs.rs` (+7 -2) 📝 `crates/horizon-client/src/shadows.rs` (+36 -1) </details> ### 📄 Description > 🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando themselves. ## What and why Fixes #3289 A mob with Invisibility had no model but still left its round shadow on the ground. The shadow pass in `game.rs` took every mob in `self.mobs` and never looked at invisibility. The shadow casters now come from `shadows::mob_casters`, which leaves out invisible mobs. `Mob::is_invisible` is the new check (`Entity.isInvisible`). A mob counts as invisible when it has the shared flag 0x20 that a server sends (`invisible`, the default server-thread path and multiplayer) or the Invisibility effect on a mob the window ticks itself (`--in-frame`). Dropped items and experience orbs are unchanged. ## Vanilla reference - `EntityRenderer.extractRenderState`: `state.isInvisible = entity.isInvisible()`. - `EntityRenderer.extractShadow`: only builds shadow pieces when `options.entityShadows` is on **and** `!state.isInvisible`. Otherwise the shadow radius stays 0 and nothing is drawn. No parity harness covers entity shadows. A unit test in `shadows.rs` checks this instead. ## Self-check `tools/pr_ready.py` was not run (Windows). These are the commands I ran: ``` cargo fmt --all -- --check # ok cargo clippy -p horizon-client --features mods --all-targets -- -D warnings # ok cargo test -p horizon-client --lib shadows:: # 3 passed ``` The new test `shadows::tests::invisible_mobs_cast_no_shadow` uses three mobs: one visible, one with the server's invisible flag, and one with the Invisibility effect. Only the visible one may cast a shadow. Before the fix (filter removed from `mob_casters`): ``` test shadows::tests::invisible_mobs_cast_no_shadow ... FAILED assertion `left == right` failed: only the visible mob casts a shadow left: [(DVec3(0.5, 64.0, 1.0), "minecraft:cow"), (DVec3(0.0, 0.0, 0.0), "minecraft:cow"), (DVec3(0.0, 0.0, 0.0), "minecraft:cow")] right: [(DVec3(0.5, 64.0, 1.0), "minecraft:cow")] test result: FAILED. 2 passed; 1 failed ``` After: ``` test shadows::tests::invisible_mobs_cast_no_shadow ... ok test shadows::tests::vanilla_radii ... ok test shadows::tests::shadows_lie_on_the_block_top_under_model_feet ... ok test result: ok. 3 passed; 0 failed ``` ## In game Two NoAI pigs stand on a concrete platform. The right one has `/effect give @e[tag=inv] minecraft:invisibility infinite 0 true`. - Before (v0.2.97): the invisible pig's shadow is still on the ground. - After (server thread, the default): no shadow under the invisible pig. - After `/effect clear`: its shadow comes back. - After with `--in-frame`: no shadow either. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:09:52 +07:00
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#5048
No description provided.