Skip to content

Minecraft: Java Edition 26.3 rewritten from scratch in Rust, checked against vanilla with 281 differential harnesses. Get it with the Horizon launcher.

OptiFine emissive textures: only block sprites pair for the terrain

some-du6e1b896eb3a668
diff --git a/crates/horizon-client-render/src/assets.rs b/crates/horizon-client-render/src/assets.rs
index 4a63bd075..2b5590c79 100644
--- a/crates/horizon-client-render/src/assets.rs
+++ b/crates/horizon-client-render/src/assets.rs
@@ -93,7 +93,7 @@ pub struct RenderAssets {
pub model_gallery: Vec<Value>,
pub animations: Vec<crate::sprites::SpriteAnimation>,
pub sprite_layers: std::collections::BTreeMap<String, u32>,
- /// OptiFine's emissive block and item overlays: base sprite and overlay sprite names.
+ /// OptiFine's emissive block overlays: base sprite and overlay sprite names.
pub emissive: Vec<(String, String)>,
pub translucent_layers: Vec<bool>,
/// Each layer's `MipmapGenerator` settings.
diff --git a/crates/horizon-client-render/src/native_emissive.rs b/crates/horizon-client-render/src/native_emissive.rs
index fa15442e1..220206c64 100644
--- a/crates/horizon-client-render/src/native_emissive.rs
+++ b/crates/horizon-client-render/src/native_emissive.rs
@@ -28,7 +28,8 @@ pub fn load(root: &Path, sprites: &mut Sprites) {
}
}
-/// OptiFine's emissive overlays of the block and item sprites already loaded: for each
+/// OptiFine's emissive overlays of the block sprites already loaded (what the terrain draws;
+/// items draw from the HUD atlas): for each
/// `<ns>:block/<name>` whose `<name><suffix>.png` sits beside it, the overlay is loaded too and
/// paired with it, first by name, at most [`MAX`]. A pack without such files adds nothing.
pub fn load_optifine(root: &Path, sprites: &mut Sprites) -> Vec<(String, String)> {
@@ -37,9 +38,8 @@ pub fn load_optifine(root: &Path, sprites: &mut Sprites) -> Vec<(String, String)
.layers
.keys()
.filter(|name| {
- name.split_once(':').is_some_and(|(_, p)| {
- (p.starts_with("block/") || p.starts_with("item/")) && !p.ends_with(&suffix)
- })
+ name.split_once(':')
+ .is_some_and(|(_, p)| p.starts_with("block/") && !p.ends_with(&suffix))
})
.cloned()
.collect();
@@ -111,21 +111,16 @@ mod tests {
.insert(&root, &format!("minecraft:block/{name}"))
.unwrap();
}
+ // Items draw from the HUD atlas, not the terrain: no pair.
sprites.insert(&root, "minecraft:item/stick").unwrap();
// glowstone isn't loaded: its overlay pairs with nothing.
let pairs = load_optifine(&root, &mut sprites);
assert_eq!(
pairs,
- [
- (
- "minecraft:block/stone".into(),
- "minecraft:block/stone_e".into()
- ),
- (
- "minecraft:item/stick".into(),
- "minecraft:item/stick_e".into()
- ),
- ]
+ [(
+ "minecraft:block/stone".into(),
+ "minecraft:block/stone_e".into()
+ ),]
);
assert!(sprites.layers.contains_key("minecraft:block/stone_e"));
// The pack's own suffix.
diff --git a/docs/resource-packs.md b/docs/resource-packs.md
index f7decac33..841d67417 100644
--- a/docs/resource-packs.md
+++ b/docs/resource-packs.md
@@ -40,7 +40,7 @@ harness named checks that loader against vanilla).
| Item definitions and item models (all model types, display transforms, tints) | `items/`, `models/item/` | works | `test_item_model_parity` |
| Custom entity models (OptiFine/EMF): a `.jem` reshapes a mob's model layer, with its animations and texture; Entity Model Features' files win over OptiFine's | `optifine/cem/`, `emf/cem/` | partly | `mobs::cem` and `mobs::cem_anim` unit tests; no per-bone textures, no random models, no textures under `optifine/` (vanilla's own entity models are code in 26.3, which `test_entity_model_parity` checks) |
| Random entity textures (OptiFine/ETF): numbered variants and their rules (biome, height, name, profession, colour, baby, health, moon, time, weather, size, blocks), chosen per entity from its UUID and rechecked once a second | `optifine/random/`, `optifine/mob/`, `mcpatcher/mob/`, `etf/random/`, `textures/entity/` with a `.properties` | partly | `horizon-optifine` `random` and `random_textures` tests, `mobs::random_textures` tests; no `nbt.*` or ETF's extra conditions (teams, items...), no block entities |
-| Emissive textures (OptiFine/ETF): `<texture>_e.png` (or the pack's `suffix.emissive`) drawn full bright over mobs, their layers and armour, armour stands, the elytra, the dragon, thrown tridents and block entities | `optifine/emissive.properties` | partly | `horizon-optifine` `emissive` tests, `mobs::render::emissive_tests`, `block_entity_render` tests; not over blocks, items, other projectiles, minecarts or end crystals |
+| Emissive textures (OptiFine/ETF): `<texture>_e.png` (or the pack's `suffix.emissive`) drawn full bright over mobs, their layers and armour, armour stands, the elytra, the dragon, thrown tridents, block entities and placed blocks | `optifine/emissive.properties` | partly | `horizon-optifine` `emissive` tests, `mobs::render::emissive_tests`, `block_entity_render` and `native_emissive` tests; at most 128 block overlays (with native mods'); not over items, other projectiles, minecarts or end crystals, nor connected-texture tiles |
| Blinking textures (ETF): `<texture>_blink.png` and `_blink2.png`, `blinkLength`/`blinkFrequency` | `textures/entity/`, random variants' folders | works | `horizon-optifine` `blink` tests, `mobs::render` blink test; sleeping villagers keep their eyes shut |
| Textures, any resolution (16x to 512x) | `textures/` | works | atlases stitched from the overlay; Faithful 32x, Default HD 128x and FPBR measured in [reuse-pack-overlays.md](reuse-pack-overlays.md) |
| Texture animation: frames, frame time, frame size | `*.png.mcmeta` `animation` | works | `test_sprite_animation_parity` |