Keep translucent item rendering with enchantment glint

This commit is contained in:
Kacpherek
2026-10-26 21:40:21 +01:00
parent d75ef5e4f7
commit a529be8915
4 changed files with 12 additions and 9 deletions
+1 -1
View File
@@ -203,7 +203,7 @@ fn crumbling_uv(uv: vec2<f32>, packed_origin: vec2<f32>, sprite_size: vec2<f32>,
// lit texture, then the lightmap, then the glint and fog.
color = vec4(mix(in.overlay_color.rgb, color.rgb, in.overlay_color.a), color.a);
color *= in.light_color;
if in.overlay == 7u || in.overlay == 8u {
if in.overlay == 7u || in.overlay == 8u || in.overlay == 33u {
// Enchantment glint (overlay 7, 8 with the hurt tint): the purple
// enchanted_glint sheen drifting diagonally over the item's shape.
let px = in.uv * vec2<f32>(textureDimensions(atlas));
+2 -1
View File
@@ -38,7 +38,8 @@ mod entity_batch;
mod weather;
use entity_batch::EntityBatch;
pub use entity_batch::{
SHADOW_OVERLAY, TRANSLUCENT_ITEM_OVERLAY, TRANSLUCENT_PARTICLE_OVERLAY, WATER_MASK_OVERLAY,
SHADOW_OVERLAY, TRANSLUCENT_GLINT_ITEM_OVERLAY, TRANSLUCENT_ITEM_OVERLAY,
TRANSLUCENT_PARTICLE_OVERLAY, WATER_MASK_OVERLAY,
};
/// Window.getAppropriateLineWidth, in framebuffer pixels.
@@ -17,6 +17,8 @@ pub const TRANSLUCENT_PARTICLE_OVERLAY: u32 = 15;
/// The overlay of item quads with translucent pixels (`Sheets.translucentItemSheet`,
/// `RenderPipelines.ITEM_TRANSLUCENT`); past the creeper swell range (16 to 31).
pub const TRANSLUCENT_ITEM_OVERLAY: u32 = 32;
/// A translucent item with an enchantment glint.
pub const TRANSLUCENT_GLINT_ITEM_OVERLAY: u32 = 33;
#[derive(Default)]
pub(super) struct EntityBatch {
@@ -49,7 +51,7 @@ impl EntityBatch {
WATER_MASK_OVERLAY => 3,
SHADOW_OVERLAY => 4,
TRANSLUCENT_PARTICLE_OVERLAY => 5,
TRANSLUCENT_ITEM_OVERLAY => 6,
TRANSLUCENT_ITEM_OVERLAY | TRANSLUCENT_GLINT_ITEM_OVERLAY => 6,
_ => 0,
};
self.buckets[material][counts[material]] = index;
+6 -6
View File
@@ -248,10 +248,9 @@ fn submit_quads(
let translucent = match last {
Some((sprite, translucent)) if sprite == q.material.sprite => translucent,
_ => {
let translucent = q.material.force_translucent
|| renderer
.sprites
.translucent(sprite_name(&q.material.sprite));
let translucent = renderer
.sprites
.translucent(sprite_name(&q.material.sprite));
last = Some((&q.material.sprite, translucent));
translucent
}
@@ -263,7 +262,7 @@ fn submit_quads(
color: argb(color),
foil,
light_emission: q.light_emission,
translucent,
translucent: translucent || q.material.force_translucent,
});
}
}
@@ -729,7 +728,8 @@ impl ItemSink for WorldSink<'_> {
let overlay = match (q.foil, q.translucent) {
(Foil::None, true) => crate::gfx::TRANSLUCENT_ITEM_OVERLAY,
(Foil::None, false) => 0,
_ => 7,
(_, true) => crate::gfx::TRANSLUCENT_GLINT_ITEM_OVERLAY,
(_, false) => 7,
};
for (p, uv) in q.pos.iter().zip(q.uv) {
self.out.push(Vertex {