diff --git a/crates/horizon-client/src/game/remote.rs b/crates/horizon-client/src/game/remote.rs index dec85e515..53f18b075 100644 --- a/crates/horizon-client/src/game/remote.rs +++ b/crates/horizon-client/src/game/remote.rs @@ -1321,8 +1321,8 @@ impl Game<'_> { let at = [f64::from(pos[0]) + 0.5, f64::from(pos[1]) + 0.5, f64::from(pos[2]) + 0.5]; self.audio.play(&s.break_sound, Some(at), (s.volume + 1.0) / 2.0, s.pitch * 0.8); self.destroy_particles(pos, state); - let fluid = self.res.facts.get(state).waterlogged; - let air = if fluid { self.world.air } else { self.world.air }; + // The server's block update follows (waterlogged blocks leave water). + let air = self.world.air; if self.world.set(pos[0], pos[1], pos[2], air).is_ok() { self.world.block_entities.remove(&(pos[0], pos[1], pos[2])); } @@ -1645,7 +1645,7 @@ impl Game<'_> { } if let Some(input) = &r.chat_input { batch.fill(atlas, 2.0, h - 14.0, w - 4.0, 12.0, rgba(0, 0, 0, 128)); - let blink = (self.started.elapsed().as_millis() / 300) % 2 == 0; + let blink = (self.started.elapsed().as_millis() / 300).is_multiple_of(2); let shown = if blink { format!("{input}_") } else { input.clone() }; batch.text(atlas, &shown, 4.0, h - 12.0, rgba(224, 224, 224, 255), true); } diff --git a/crates/horizon-client/src/title.rs b/crates/horizon-client/src/title.rs index 430419cca..c720d6183 100644 --- a/crates/horizon-client/src/title.rs +++ b/crates/horizon-client/src/title.rs @@ -158,7 +158,7 @@ impl Title { batch.text(atlas, &shown, w / 2.0 - 96.0, y + 17.0, rgba(224, 224, 224, 255), true); } } - Mode::Multiplayer(screen) => screen.draw(atlas, batch, (self.started.elapsed().as_millis() / 300) % 2 == 0), + Mode::Multiplayer(screen) => screen.draw(atlas, batch, (self.started.elapsed().as_millis() / 300).is_multiple_of(2)), } for b in self.buttons(w, h) { let hover = b.enabled && cursor.0 >= b.x && cursor.0 < b.x + b.w && cursor.1 >= b.y && cursor.1 < b.y + 20.0; diff --git a/crates/horizon-protocol/src/chunk.rs b/crates/horizon-protocol/src/chunk.rs index 343f7c7aa..3343eacf5 100644 --- a/crates/horizon-protocol/src/chunk.rs +++ b/crates/horizon-protocol/src/chunk.rs @@ -253,7 +253,7 @@ packet!( impl LightData { /// Per light section: the sky and block DataLayers (None = absent/unchanged, /// Some(zeroed) when marked empty). - pub fn layers(&self, light_sections: usize) -> Vec<(Option>, Option>)> { + pub fn layers(&self, light_sections: usize) -> Vec { use crate::buf::bit; let (mut sky, mut block) = (self.sky.iter(), self.block.iter()); (0..light_sections) @@ -277,6 +277,8 @@ impl LightData { .collect() } } +/// A light section's (sky, block) DataLayers. +pub type SectionLight = (Option>, Option>); /// DataLayer.get: the nibble at (y << 8 | z << 4 | x), low nibble first. pub fn nibble(layer: &[u8], i: usize) -> u8 { layer