From 69b62576ea805c2674144f5f600ad00fecdbb111 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 3 Apr 2025 18:37:36 +0200 Subject: [PATCH 1/3] world/chunk: fix new Rust 1.86 clippy warning --- src/world/chunk.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/world/chunk.rs b/src/world/chunk.rs index 311fca8..aadf882 100644 --- a/src/world/chunk.rs +++ b/src/world/chunk.rs @@ -419,7 +419,7 @@ impl<'a> Iterator for SectionIter<'a> { } fn last(mut self) -> Option { - self.with_iter(|iter| iter.last()) + self.next_back() } } From dd56e842b526774aa0d1bba035b7da6d7cdd57e9 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 3 Apr 2025 18:31:41 +0200 Subject: [PATCH 2/3] ci: update to Rust 1.86 There is no official 1.86 Docker image yet. --- .github/workflows/MinedMap.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/MinedMap.yml b/.github/workflows/MinedMap.yml index ece4e50..4dbb5d2 100644 --- a/.github/workflows/MinedMap.yml +++ b/.github/workflows/MinedMap.yml @@ -48,7 +48,7 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - toolchain: '1.85.1' + toolchain: '1.86' components: rustfmt - run: cargo fmt --all -- --check @@ -58,7 +58,7 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - toolchain: '1.85.1' + toolchain: '1.86' components: clippy - uses: swatinem/rust-cache@v2 - uses: actions-rs/clippy-check@v1 @@ -72,7 +72,7 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - toolchain: '1.85.1' + toolchain: '1.86' components: rust-docs - uses: swatinem/rust-cache@v2 - run: cargo doc --workspace --no-deps --document-private-items @@ -87,7 +87,7 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - toolchain: '1.85.1' + toolchain: '1.86' - uses: swatinem/rust-cache@v2 - run: cargo test --workspace - run: cargo test --workspace --no-default-features @@ -127,7 +127,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: - toolchain: '1.85.1' + toolchain: '1.86' targets: '${{ matrix.target }}' - uses: swatinem/rust-cache@v2 From ca880ab3b457a12f775e83a43b3ede5804f7bc63 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 3 Apr 2025 18:26:49 +0200 Subject: [PATCH 3/3] world/text_value: do not fall back to NBT deserialization after DataVersion 4290 An invalid JSON string should not be emitted verbatim; ignore the content instead. Also increment entity meta version, which had been forgotten in the previous commit. --- src/core/common.rs | 2 +- src/world/text_value.rs | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/core/common.rs b/src/core/common.rs index d285f4c..45b541c 100644 --- a/src/core/common.rs +++ b/src/core/common.rs @@ -48,7 +48,7 @@ pub const MIPMAP_FILE_META_VERSION: FileMetaVersion = FileMetaVersion(0); /// MinedMap processed entity data version number /// /// Increase when entity collection changes bacause of code changes. -pub const ENTITIES_FILE_META_VERSION: FileMetaVersion = FileMetaVersion(2); +pub const ENTITIES_FILE_META_VERSION: FileMetaVersion = FileMetaVersion(3); /// Coordinate pair of a generated tile /// diff --git a/src/world/text_value.rs b/src/world/text_value.rs index 75defc4..3de6593 100644 --- a/src/world/text_value.rs +++ b/src/world/text_value.rs @@ -176,15 +176,20 @@ pub struct TextValue(pub fastnbt::Value); impl TextValue { /// Deserializes a [TextValue] into a [DeserializedText] pub fn deserialize(&self, data_version: u32) -> DeserializedText { + // TODO: Improve error handling + // + // Unfortunately, there are a number of weird ways an empty sign coould + // be encoded (for example a compound with an "" key), so for now we + // simply interpret undecodable data as empty. if data_version < 4290 { - if let fastnbt::Value::String(json) = &self.0 { - if let Ok(content) = serde_json::from_str(json) { - return content; - } - } - } + let fastnbt::Value::String(json) = &self.0 else { + return DeserializedText::default(); + }; - fastnbt::from_value(&self.0).unwrap_or_default() + serde_json::from_str(json).unwrap_or_default() + } else { + fastnbt::from_value(&self.0).unwrap_or_default() + } } }