[PR #197] [MERGED] End crystals from EndCrystalModel: lit, with their base and beams #2397

Closed
opened 2026-11-02 15:55:41 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/197
Author: @ludovic111
Created: 10/14/2026
Status: ✅ Merged
Merged: 10/14/2026
Merged by: @ludovic111

Base: main ← Head: fix/end-crystal-102


📝 Commits (1)

  • ee697ca End crystals from EndCrystalModel, lit, with their base and beams

📊 Changes

7 files changed (+135 additions, -139 deletions)

View changed files

📝 crates/horizon-client/examples/entity_anim_fixture.rs (+45 -28)
➕ crates/horizon-client/src/end_crystal.rs (+38 -0)
📝 crates/horizon-client/src/game.rs (+3 -0)
📝 crates/horizon-client/src/game/dragon.rs (+2 -4)
📝 crates/horizon-client/src/game/end.rs (+42 -105)
📝 crates/horizon-client/src/lib.rs (+1 -0)
📝 tools/test_entity_model_parity.py (+4 -2)

📄 Description

Fixes #102

What was wrong. game/end.rs drew End crystals as a hand-built mesh: every vertex had a zero normal (so the entity shader couldn't shade the faces: the "almost no lighting" look), the base part was missing (so spike crystals, which vanilla spawns with showsBottom, had no bedrock base), and a crystal's beam to its target was never drawn. Crystals were also only drawn in the End.

Fix (EndCrystalRenderer / EndCrystalModel)

  • New horizon_client::end_crystal: y(age) = EndCrystalRenderer.getY (with Mth.sin), poses(model, age, show_bottom) = EndCrystalModel.setupAnim: base.visible = showsBottom, outer_glass.y += getY*16/2, outer glass rotateBy(YP(age*3°)·axis(60°, sin45,0,sin45)), inner glass and cube rotateBy(axis(60°)·Y(age*3°)), stored as ZYX angles like ModelPart.rotateBy.
  • The renderer draws the baked minecraft:end_crystal#main layer with mobs::render::draw (real normals) under scale(2) · translate(0,-0.5,0) (not flipped), NO_OVERLAY, the packed light at the crystal's block (the spike's fire gives block light 15).
  • A crystal with a beam target draws submitCrystalBeams from the target's centre to the crystal (crystal - target + getY), reusing the dragon's beam code; the dragon's healing beam now uses the same getY.
  • Crystals draw in any dimension (player-placed ones in the Overworld were invisible).

Harness (tools/test_entity_model_parity.py): end_crystal is no longer skipped. The oracle runs the real EndCrystalModel.setupAnim on EndCrystalRenderState (ages up to 91234.5, base shown or hidden); the fixture poses the layer with end_crystal::poses and the @partScale override now applies on that path too. Mac mini: entity model parity ok, 5846 cases over 161 layers (end_crystal: 31 cases, every part pose and every vertex normal byte-equal or one truncation step apart).

In game (vscreen): agent-state/wave5b-shots/102-crystal-before-after.png on the desktop: the same spike crystal on main (left: flat faces, no base) and with this branch (right: shaded faces, bedrock base); 102-crystal-spike.png shows two frames of the spinning, bobbing crystal on its spike. The beam isn't seen in game (it only shows during a dragon respawn, and /summon end_crystal isn't supported yet).

cargo fmt --check and cargo clippy --workspace --all-targets -D warnings on the Mac mini: clean.

🤖 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/197 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/14/2026 **Status:** ✅ Merged **Merged:** 10/14/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/end-crystal-102` --- ### 📝 Commits (1) - [`ee697ca`](https://github.com/horizon-rust/horizon/commit/ee697cadc60e2d0cd854d22386f48fb36f03083a) End crystals from EndCrystalModel, lit, with their base and beams ### 📊 Changes **7 files changed** (+135 additions, -139 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/entity_anim_fixture.rs` (+45 -28) ➕ `crates/horizon-client/src/end_crystal.rs` (+38 -0) 📝 `crates/horizon-client/src/game.rs` (+3 -0) 📝 `crates/horizon-client/src/game/dragon.rs` (+2 -4) 📝 `crates/horizon-client/src/game/end.rs` (+42 -105) 📝 `crates/horizon-client/src/lib.rs` (+1 -0) 📝 `tools/test_entity_model_parity.py` (+4 -2) </details> ### 📄 Description Fixes #102 **What was wrong.** `game/end.rs` drew End crystals as a hand-built mesh: every vertex had a zero normal (so the entity shader couldn't shade the faces: the "almost no lighting" look), the `base` part was missing (so spike crystals, which vanilla spawns with `showsBottom`, had no bedrock base), and a crystal's beam to its target was never drawn. Crystals were also only drawn in the End. **Fix (EndCrystalRenderer / EndCrystalModel)** - New `horizon_client::end_crystal`: `y(age)` = `EndCrystalRenderer.getY` (with `Mth.sin`), `poses(model, age, show_bottom)` = `EndCrystalModel.setupAnim`: `base.visible = showsBottom`, `outer_glass.y += getY*16/2`, outer glass `rotateBy(YP(age*3°)·axis(60°, sin45,0,sin45))`, inner glass and cube `rotateBy(axis(60°)·Y(age*3°))`, stored as ZYX angles like `ModelPart.rotateBy`. - The renderer draws the baked `minecraft:end_crystal#main` layer with `mobs::render::draw` (real normals) under `scale(2) · translate(0,-0.5,0)` (not flipped), `NO_OVERLAY`, the packed light at the crystal's block (the spike's fire gives block light 15). - A crystal with a beam target draws `submitCrystalBeams` from the target's centre to the crystal (`crystal - target + getY`), reusing the dragon's beam code; the dragon's healing beam now uses the same `getY`. - Crystals draw in any dimension (player-placed ones in the Overworld were invisible). **Harness (tools/test_entity_model_parity.py)**: `end_crystal` is no longer skipped. The oracle runs the real `EndCrystalModel.setupAnim` on `EndCrystalRenderState` (ages up to 91234.5, base shown or hidden); the fixture poses the layer with `end_crystal::poses` and the `@partScale` override now applies on that path too. Mac mini: **entity model parity ok, 5846 cases over 161 layers** (end_crystal: 31 cases, every part pose and every vertex normal byte-equal or one truncation step apart). **In game (vscreen)**: `agent-state/wave5b-shots/102-crystal-before-after.png` on the desktop: the same spike crystal on main (left: flat faces, no base) and with this branch (right: shaded faces, bedrock base); `102-crystal-spike.png` shows two frames of the spinning, bobbing crystal on its spike. The beam isn't seen in game (it only shows during a dragon respawn, and `/summon end_crystal` isn't supported yet). `cargo fmt --check` and `cargo clippy --workspace --all-targets -D warnings` on the Mac mini: clean. 🤖 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-02 15:55:41 +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#2397
No description provided.