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.

Maps and stopwatches: a failed save is logged instead of dropped

Alexander Krylov11bdbd471223
diff --git a/crates/horizon-client/src/game/maps.rs b/crates/horizon-client/src/game/maps.rs
index 39ac17e61..c39d6f2b9 100644
--- a/crates/horizon-client/src/game/maps.rs
+++ b/crates/horizon-client/src/game/maps.rs
@@ -1615,10 +1615,12 @@ impl Game<'_> {
("data", Tag::compound([("map", Tag::Int(last))])),
("DataVersion", Tag::Int(horizon_world::DATA_VERSION)),
]);
- let _ = horizon_client::save::write_dat(
+ if let Err(e) = horizon_client::save::write_dat(
&self.world_root.join("data/minecraft/maps/last_id.dat"),
tag,
- );
+ ) {
+ log::warn!("Horizon: the next map id is not saved: {e}");
+ }
}
}
/// The atlas slot showing map `id`, its texture uploaded when it changed.
diff --git a/crates/horizon-client/src/stopwatches.rs b/crates/horizon-client/src/stopwatches.rs
index 3d15d19a4..b058e9d79 100644
--- a/crates/horizon-client/src/stopwatches.rs
+++ b/crates/horizon-client/src/stopwatches.rs
@@ -67,13 +67,15 @@ impl Stopwatches {
.iter()
.map(|(k, w)| (k.as_str().into(), Tag::Long(w.elapsed_ms(now))))
.collect();
- let _ = save::write_dat(
+ if let Err(e) = save::write_dat(
&file(root),
Tag::compound([
("data", Tag::compound([("stopwatches", Tag::Compound(map))])),
("DataVersion", Tag::Int(horizon_world::DATA_VERSION)),
]),
- );
+ ) {
+ log::warn!("Horizon: the stopwatches are not saved: {e}");
+ }
}
pub fn ids(&self) -> Vec<String> {
self.watches.keys().cloned().collect()