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: thrown tridents glow where the game draws them

some-du6e742df9fb5910
diff --git a/crates/horizon-client-render/src/hud.rs b/crates/horizon-client-render/src/hud.rs
index cce6815ad..1bf14d1e2 100644
--- a/crates/horizon-client-render/src/hud.rs
+++ b/crates/horizon-client-render/src/hud.rs
@@ -788,18 +788,23 @@ impl HudAtlas {
named.len() - kept.len()
);
}
- // A dropped variant beside its texture takes its walked overlay with it: nothing
- // would draw it.
+ // A dropped variant beside its texture takes its walked overlay and blink frames
+ // (and theirs) with it: nothing would draw them.
let png = format!("{}.png", emissive.suffix);
+ let png = png.as_str();
let orphans: HashSet<PathBuf> = named
.keys()
.filter(|p| !kept.contains(*p))
- .filter_map(|p| {
- Some(PathBuf::from(format!(
- "{}{png}",
- p.to_str()?.strip_suffix(".png")?
- )))
+ .filter_map(|p| p.to_str()?.strip_suffix(".png").map(str::to_owned))
+ .flat_map(|stem| {
+ ["", "_blink", "_blink2"]
+ .into_iter()
+ .flat_map(move |frame| {
+ [format!("{stem}{frame}.png"), format!("{stem}{frame}{png}")]
+ })
})
+ .map(PathBuf::from)
+ .filter(|p| !named.contains_key(p))
.collect();
files.retain(|p| (!named.contains_key(p) || kept.contains(p)) && !orphans.contains(p));
// Those beside their texture are walked already.
diff --git a/crates/horizon-client/src/game/creatures.rs b/crates/horizon-client/src/game/creatures.rs
index 7440eebc1..f785e1a24 100644
--- a/crates/horizon-client/src/game/creatures.rs
+++ b/crates/horizon-client/src/game/creatures.rs
@@ -6444,28 +6444,6 @@ impl Game<'_> {
0,
out,
);
- // The trident texture's OptiFine emissive overlay, full bright.
- let glow = self
- .res
- .mob_data()
- .emissive
- .read()
- .unwrap_or_else(std::sync::PoisonError::into_inner)
- .overlay("entity/trident/trident")
- .and_then(|e| atlas.sprites.get(e))
- .copied();
- if let Some(g) = glow {
- horizon_client::mobs::render::draw(
- model,
- m,
- &poses,
- [g.u0, g.v0, g.u1, g.v1],
- 0xFFFF_FFFF,
- horizon_client::mobs::render::FULL_BRIGHT,
- 0,
- out,
- );
- }
continue;
}
// WindChargeRenderer.
diff --git a/crates/horizon-client/src/game/trident.rs b/crates/horizon-client/src/game/trident.rs
index 1fdddc605..192fda5a3 100644
--- a/crates/horizon-client/src/game/trident.rs
+++ b/crates/horizon-client/src/game/trident.rs
@@ -737,6 +737,16 @@ impl Game<'_> {
else {
return;
};
+ // The texture's OptiFine emissive overlay, drawn again full bright.
+ let glow = self
+ .res
+ .mob_data()
+ .emissive
+ .read()
+ .unwrap_or_else(std::sync::PoisonError::into_inner)
+ .overlay("entity/trident/trident")
+ .and_then(|e| self.gui.atlas.sprites.get(e))
+ .map(|r| [r.u0, r.v0, r.u1, r.v1]);
// AbstractArrow.shouldRenderAtSqrDistance: ten times the default.
let range = 10.0
* super::entity_culling::default_range(
@@ -795,6 +805,19 @@ impl Game<'_> {
0,
out,
);
+ if let Some(glow) = glow {
+ let full = horizon_client::mobs::render::FULL_BRIGHT;
+ horizon_client::mobs::render::draw(
+ model,
+ base,
+ &poses,
+ glow,
+ 0xFFFF_FFFF,
+ full,
+ 0,
+ out,
+ );
+ }
}
}
}