[PR #6572] [MERGED] OptiFine entity models: packs' .jem files reshape chests, shulker boxes, banners and other block entities #6958

Closed
opened 2026-11-03 06:30:19 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6572
Author: @some-du6e
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: optifine/emf-block-entities


📝 Commits (8)

  • 89b6008 OptiFine entity models: packs' .jem files reshape chests, shulker boxes, banners and other block entities
  • 3711915 Merge main into optifine/emf-block-entities
  • 5f75afd OptiFine entity models: the block entity test scene has no emissive overlays
  • 7a39319 OptiFine entity models: ender, trapped and copper chests keep vanilla's shape without their own .jem
  • 5b47e1f Merge main into optifine/emf-block-entities
  • c3911b7 OptiFine entity models: a shared .jem paints only the models it reshapes
  • a2f0a5b OptiFine entity models: let the chest arm auto-deref its shapes (clippy)
  • 55487cb OptiFine entity models: the module doc says a .jem paints the models it reshapes

📊 Changes

9 files changed (+1132 additions, -198 deletions)

View changed files

➕ crates/horizon-client-render/src/block_entity_cem.rs (+630 -0)
📝 crates/horizon-client-render/src/block_entity_render.rs (+349 -84)
📝 crates/horizon-client-render/src/lib.rs (+1 -0)
📝 crates/horizon-client/src/game/packs.rs (+8 -0)
📝 crates/horizon-client/src/mobs/cem.rs (+5 -112)
➕ crates/horizon-optifine/src/cem/files.rs (+136 -0)
📝 crates/horizon-optifine/src/cem/mod.rs (+1 -0)
📝 docs/architecture.md (+1 -1)
📝 docs/resource-packs.md (+1 -1)

📄 Description

Packs' OptiFine custom entity models already reshape mobs, but block entities still drew vanilla's shapes. That leaves out a pack's chests, shulker boxes, banners, bells, books, conduits, decorated pots and heads. This PR applies their .jem files the way mobs' are applied, as Entity Model Features does on Fabric.

What players get:

  • optifine/cem/ (and EMF's emf/cem/, which wins) .jem files reshape:
    • chest, chest_left/chest_right, trapped_chest (and _left/_right), ender_chest
    • shulker_box
    • banner / banner_base / banner_flag
    • bell
    • book / enchanting_book / lectern_book
    • conduit
    • decorated_pot
    • the seven heads: head_creeper, head_dragon, head_piglin, head_player, head_skeleton, head_wither_skeleton, head_zombie
  • Each entry replaces or joins the vanilla part's boxes, with its pivot, rotation and scale. The closed-chest meshes are baked from the reshaped models.
  • OptiFine's part names map to the game's. The names the renderer poses (lid/lock, flag, jaw, the ears, bell_body, the book's lids, pages and flipping pages) come from its code. The rest (bottom, pole, bar, seam, the conduit's shell, the pot's parts) come from the exported models (entity-models.json). A table-driven test lands every name on its vanilla part, with a box of its own, so a swapped pair shows. A name the table doesn't know is tried as the vanilla name itself, as for mobs. The mapping:
    • chests: base → bottom, knob → lock
    • banners: stand → pole, top → bar, slate → flag
    • bell: body/base → bell_body/bell_base
    • books: covers, pages and spine → *_lid, *_pages, seam
    • conduit: base/cage → the shell and cage layers
    • the pot's sides and base, and the heads' jaw and ears
  • Fallbacks follow OptiFine's table: lectern_book falls back to book. Trapped and ender chests read only their own files, since the table lists no fallback for them, and copper chests (no CEM name) keep vanilla's model. So a chest.jem with its own UV layout never garbles them.
  • A .jem texture under textures/ replaces vanilla's when the atlas has it, on the models the file reshapes. A conduit.jem that only reshapes the eye leaves the shell, cage and wind on their own textures. Its emissive (_e) overlay follows it, since the overlay is looked up by the drawn texture.
  • Banner patterns, pot sherds and player heads with a profile keep their own textures. A chest .jem's texture also wins over the December chest texture, and one shulker_box.jem texture paints every colour, as the file names a single texture.
  • Pack reloads rebuild the shapes on the reload worker and swap them in, as mob models already are. With no .jem files nothing is built, and the vanilla set is shared.

Not in this PR:

  • animations on block entities
  • signs, hanging signs and beds: Horizon draws them as block models
  • copper golem statues: they have no CEM name
  • per-bone textures and random models
  • The flipping pages' right/left assignment (flip_page1/flip_page2) is a guess: the docs don't say which is which.

Size: about +1000/−200, over the ~500 guideline. About 90 lines are file-discovery helpers moved unchanged from mobs/cem.rs into horizon-optifine/src/cem/files.rs, so mobs and block entities share them. About 40 are the closed-chest baking moved into a function so it can rerun on reload, and about 255 are tests.

Docs I worked from (no mod source read): OptiFine's cem_model.txt (the block entity table and fallbacks), EMF's emf_model.txt and FEATURES.md.

Checks:

  • cargo fmt: clean

  • Local run (the one allowed on this machine): the jem_files precedence test, now beside the code in horizon-optifine, passed

  • Tests:

    • every OptiFine part name lands on its vanilla part
    • replace and attach, a raw vanilla name, an unknown part warned about
    • book.jem reaching the lectern
    • trapped and ender chests untouched by chest.jem
    • no files leaves the models alone
    • end to end through the real draw path: a closed chest goes from 3 faces to 8 and draws in the .jem texture, ender and copper chests keep vanilla's model and texture, and a mob-only .jem leaves the block entity models shared with vanilla
  • Build, clippy and the suite run in fork CI, since this machine doesn't build. verify (build, clippy, tests) passed on a2f0a5b in fork CI (run 41363380016); the PR's own CI waits for maintainer approval

  • Not run: the game, since there's no vanilla data (.local/) here. Worth a look with a CEM chest pack.

  • Review loop:

    • round 1 (two reviewers covering every lens) found the chest borrowing and the test gaps, fixed in 7a3931907
    • round 2 found a shared file's texture painting models it didn't reshape, and a mapping test that couldn't catch swapped names, fixed in c3911b760
    • round 3 found nothing real, only a stale comment and this line, fixed after
    • the live game test is skipped (no .local/)

Note

Filed by Opus 5.5 using 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/6572 **Author:** [@some-du6e](https://github.com/some-du6e) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `optifine/emf-block-entities` --- ### 📝 Commits (8) - [`89b6008`](https://github.com/horizon-rust/horizon/commit/89b6008f8bb3b932f005e0b06dde09444057bfbe) OptiFine entity models: packs' .jem files reshape chests, shulker boxes, banners and other block entities - [`3711915`](https://github.com/horizon-rust/horizon/commit/3711915577a803f656e3677405d31d675e8c1b2d) Merge main into optifine/emf-block-entities - [`5f75afd`](https://github.com/horizon-rust/horizon/commit/5f75afdbd01054f27727336fa2d1000d56683e79) OptiFine entity models: the block entity test scene has no emissive overlays - [`7a39319`](https://github.com/horizon-rust/horizon/commit/7a39319074998d6dd73844f604e71eaa606c6a11) OptiFine entity models: ender, trapped and copper chests keep vanilla's shape without their own .jem - [`5b47e1f`](https://github.com/horizon-rust/horizon/commit/5b47e1f45becd982bc54aa468e43937553369224) Merge main into optifine/emf-block-entities - [`c3911b7`](https://github.com/horizon-rust/horizon/commit/c3911b7608be67ec10e0d6d87a401b9d35d22af4) OptiFine entity models: a shared .jem paints only the models it reshapes - [`a2f0a5b`](https://github.com/horizon-rust/horizon/commit/a2f0a5baa882b8139116e2d9d4ed5ae843e75398) OptiFine entity models: let the chest arm auto-deref its shapes (clippy) - [`55487cb`](https://github.com/horizon-rust/horizon/commit/55487cb931414f00b02b99bbea2e406ca91d8430) OptiFine entity models: the module doc says a .jem paints the models it reshapes ### 📊 Changes **9 files changed** (+1132 additions, -198 deletions) <details> <summary>View changed files</summary> ➕ `crates/horizon-client-render/src/block_entity_cem.rs` (+630 -0) 📝 `crates/horizon-client-render/src/block_entity_render.rs` (+349 -84) 📝 `crates/horizon-client-render/src/lib.rs` (+1 -0) 📝 `crates/horizon-client/src/game/packs.rs` (+8 -0) 📝 `crates/horizon-client/src/mobs/cem.rs` (+5 -112) ➕ `crates/horizon-optifine/src/cem/files.rs` (+136 -0) 📝 `crates/horizon-optifine/src/cem/mod.rs` (+1 -0) 📝 `docs/architecture.md` (+1 -1) 📝 `docs/resource-packs.md` (+1 -1) </details> ### 📄 Description Packs' OptiFine custom entity models already reshape mobs, but block entities still drew vanilla's shapes. That leaves out a pack's chests, shulker boxes, banners, bells, books, conduits, decorated pots and heads. This PR applies their `.jem` files the way mobs' are applied, as Entity Model Features does on Fabric. **What players get:** - `optifine/cem/` (and EMF's `emf/cem/`, which wins) `.jem` files reshape: - `chest`, `chest_left`/`chest_right`, `trapped_chest` (and `_left`/`_right`), `ender_chest` - `shulker_box` - `banner` / `banner_base` / `banner_flag` - `bell` - `book` / `enchanting_book` / `lectern_book` - `conduit` - `decorated_pot` - the seven heads: `head_creeper`, `head_dragon`, `head_piglin`, `head_player`, `head_skeleton`, `head_wither_skeleton`, `head_zombie` - Each entry replaces or joins the vanilla part's boxes, with its pivot, rotation and `scale`. The closed-chest meshes are baked from the reshaped models. - OptiFine's part names map to the game's. The names the renderer poses (`lid`/`lock`, `flag`, `jaw`, the ears, `bell_body`, the book's lids, pages and flipping pages) come from its code. The rest (`bottom`, `pole`, `bar`, `seam`, the conduit's `shell`, the pot's parts) come from the exported models (`entity-models.json`). A table-driven test lands every name on its vanilla part, with a box of its own, so a swapped pair shows. A name the table doesn't know is tried as the vanilla name itself, as for mobs. The mapping: - chests: `base` → `bottom`, `knob` → `lock` - banners: `stand` → `pole`, `top` → `bar`, `slate` → `flag` - bell: `body`/`base` → `bell_body`/`bell_base` - books: covers, pages and spine → `*_lid`, `*_pages`, `seam` - conduit: `base`/`cage` → the shell and cage layers - the pot's sides and base, and the heads' `jaw` and ears - Fallbacks follow OptiFine's table: `lectern_book` falls back to `book`. Trapped and ender chests read only their own files, since the table lists no fallback for them, and copper chests (no CEM name) keep vanilla's model. So a `chest.jem` with its own UV layout never garbles them. - A `.jem` texture under `textures/` replaces vanilla's when the atlas has it, on the models the file reshapes. A `conduit.jem` that only reshapes the eye leaves the shell, cage and wind on their own textures. Its emissive (`_e`) overlay follows it, since the overlay is looked up by the drawn texture. - Banner patterns, pot sherds and player heads with a profile keep their own textures. A chest `.jem`'s texture also wins over the December chest texture, and one `shulker_box.jem` texture paints every colour, as the file names a single texture. - Pack reloads rebuild the shapes on the reload worker and swap them in, as mob models already are. With no `.jem` files nothing is built, and the vanilla set is shared. **Not in this PR:** - animations on block entities - signs, hanging signs and beds: Horizon draws them as block models - copper golem statues: they have no CEM name - per-bone textures and random models - The flipping pages' right/left assignment (`flip_page1`/`flip_page2`) is a guess: the docs don't say which is which. **Size:** about +1000/−200, over the ~500 guideline. About 90 lines are file-discovery helpers moved unchanged from `mobs/cem.rs` into `horizon-optifine/src/cem/files.rs`, so mobs and block entities share them. About 40 are the closed-chest baking moved into a function so it can rerun on reload, and about 255 are tests. Docs I worked from (no mod source read): OptiFine's `cem_model.txt` (the block entity table and fallbacks), EMF's `emf_model.txt` and `FEATURES.md`. Checks: - `cargo fmt`: clean - Local run (the one allowed on this machine): the `jem_files` precedence test, now beside the code in `horizon-optifine`, passed - Tests: - every OptiFine part name lands on its vanilla part - replace and attach, a raw vanilla name, an unknown part warned about - `book.jem` reaching the lectern - trapped and ender chests untouched by `chest.jem` - no files leaves the models alone - end to end through the real draw path: a closed chest goes from 3 faces to 8 and draws in the `.jem` texture, ender and copper chests keep vanilla's model and texture, and a mob-only `.jem` leaves the block entity models shared with vanilla - Build, clippy and the suite run in fork CI, since this machine doesn't build. `verify` (build, clippy, tests) passed on a2f0a5b in fork CI (run 41363380016); the PR's own CI waits for maintainer approval - Not run: the game, since there's no vanilla data (`.local/`) here. Worth a look with a CEM chest pack. - Review loop: - round 1 (two reviewers covering every lens) found the chest borrowing and the test gaps, fixed in 7a3931907 - round 2 found a shared file's texture painting models it didn't reshape, and a mapping test that couldn't catch swapped names, fixed in c3911b760 - round 3 found nothing real, only a stale comment and this line, fixed after - the live game test is skipped (no `.local/`) > [!NOTE] > Filed by Opus 5.5 using 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 06:30:19 +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#6958
No description provided.