[PR #6578] [MERGED] OptiFine packs: CTM tiles picked by one rule can be picked again by another #6960

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/6578
Author: @some-du6e
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: optifine/ctm-chained


📝 Commits (7)

  • 6fdeef1 OptiFine CTM: a picked tile can be matched by another rule
  • 048f3b6 OptiFine CTM chained tiles: no rerun of rules already tried
  • 88f4b82 OptiFine CTM chained tiles: rules after the pick still chain
  • 69c1111 Merge main into #6578
  • 8086d13 Merge remote-tracking branch 'origin/main' into optifine/ctm-chained
  • 5c2a3cc Merge branch 'optifine/ctm-chained' of https://github.com/some-du6e/horizon into optifine/ctm-chained
  • ada1b8b Merge remote-tracking branch 'origin/main' into optifine/ctm-chained

📊 Changes

1 file changed (+68 additions, -0 deletions)

View changed files

📝 crates/horizon-client-render/src/connected.rs (+68 -0)

📄 Description

OptiFine's ctm.properties says "Tiles output by CTM rules can also be matched by another rule". A pack can give a block one tile with one rule, then vary that tile with a second rule naming it (matchTiles=optifine/ctm/mygrass/1.png), for example randomising one of the 47 glass tiles. Horizon stopped at the first rule, so the second one never applied.

ConnectedTextures::pick (crates/horizon-client-render/src/connected.rs): once a rule picks a tile, the tile rules naming that tile are tried once more, in rule order. They are skipped if they name blocks and this block isn't one of them. The rule that picked the tile, and rules already tried on the face's own sprite (those before it), are skipped too, so an overlay naming both draws once. There's no second pass when the picked tile is the face's own sprite (tiles=stone).

  • A tile from that second pass replaces the first pick. <default> keeps the first pick. <skip> moves on to the next tile rule.
  • connect=tile joins in the second pass still compare the face's own sprite with its neighbours', since that's what the neighbours show.
  • One extra pass only, so rules can't loop.

Known edge: sprites with identical pixels share one sprite layer. A tile identical to the vanilla texture can therefore also be matched by rules naming that texture.

Faces without CTM rules don't reach this code.

Docs used: OptiFine's OptiFineDoc/doc/ctm.properties (matchTiles). No mod source was read.

Checks: cargo fmt; cargo test -p horizon-client-render --lib connected:: (15 tests, one new: a_picked_tile_can_be_picked_again, which covers a chained tile, <default>, a chained rule naming another block, and an overlay that must draw once). Fork CI runs on each push: https://github.com/some-du6e/horizon/actions?query=branch%3Aoptifine%2Fctm-chained. There's no live game test: this machine has no vanilla data (.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/6578 **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/ctm-chained` --- ### 📝 Commits (7) - [`6fdeef1`](https://github.com/horizon-rust/horizon/commit/6fdeef19a7be635e148aea2f8dd27a98976df3ef) OptiFine CTM: a picked tile can be matched by another rule - [`048f3b6`](https://github.com/horizon-rust/horizon/commit/048f3b6e87d25fef4132691a19102c166dca86c6) OptiFine CTM chained tiles: no rerun of rules already tried - [`88f4b82`](https://github.com/horizon-rust/horizon/commit/88f4b82bfe932acb97ad74c71c4c00cb98757757) OptiFine CTM chained tiles: rules after the pick still chain - [`69c1111`](https://github.com/horizon-rust/horizon/commit/69c11117a62344809e3e207f7993b882a7adda9a) Merge main into #6578 - [`8086d13`](https://github.com/horizon-rust/horizon/commit/8086d137e5519aa1935f680d9c8fbbf86b529a73) Merge remote-tracking branch 'origin/main' into optifine/ctm-chained - [`5c2a3cc`](https://github.com/horizon-rust/horizon/commit/5c2a3cc945f958c38369fb852dd8a67247b06f30) Merge branch 'optifine/ctm-chained' of https://github.com/some-du6e/horizon into optifine/ctm-chained - [`ada1b8b`](https://github.com/horizon-rust/horizon/commit/ada1b8b1e4e21287bc4fda476699957fb4a37410) Merge remote-tracking branch 'origin/main' into optifine/ctm-chained ### 📊 Changes **1 file changed** (+68 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/connected.rs` (+68 -0) </details> ### 📄 Description OptiFine's `ctm.properties` says "Tiles output by CTM rules can also be matched by another rule". A pack can give a block one tile with one rule, then vary that tile with a second rule naming it (`matchTiles=optifine/ctm/mygrass/1.png`), for example randomising one of the 47 glass tiles. Horizon stopped at the first rule, so the second one never applied. `ConnectedTextures::pick` (`crates/horizon-client-render/src/connected.rs`): once a rule picks a tile, the tile rules naming that tile are tried once more, in rule order. They are skipped if they name blocks and this block isn't one of them. The rule that picked the tile, and rules already tried on the face's own sprite (those before it), are skipped too, so an overlay naming both draws once. There's no second pass when the picked tile is the face's own sprite (`tiles=stone`). - A tile from that second pass replaces the first pick. `<default>` keeps the first pick. `<skip>` moves on to the next tile rule. - `connect=tile` joins in the second pass still compare the face's own sprite with its neighbours', since that's what the neighbours show. - One extra pass only, so rules can't loop. Known edge: sprites with identical pixels share one sprite layer. A tile identical to the vanilla texture can therefore also be matched by rules naming that texture. Faces without CTM rules don't reach this code. **Docs used:** OptiFine's `OptiFineDoc/doc/ctm.properties` (`matchTiles`). No mod source was read. **Checks:** `cargo fmt`; `cargo test -p horizon-client-render --lib connected::` (15 tests, one new: `a_picked_tile_can_be_picked_again`, which covers a chained tile, `<default>`, a chained rule naming another block, and an overlay that must draw once). Fork CI runs on each push: https://github.com/some-du6e/horizon/actions?query=branch%3Aoptifine%2Fctm-chained. There's no live game test: this machine has no vanilla data (`.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#6960
No description provided.