Compare commits

..

4 commits

Author SHA1 Message Date
118034dd27
Merge pull request #77 from neocturne/textvalue
Some checks failed
MinedMap / viewer (push) Has been cancelled
MinedMap / fmt (push) Has been cancelled
MinedMap / clippy (push) Has been cancelled
MinedMap / docs (push) Has been cancelled
MinedMap / test (macOS-latest) (push) Has been cancelled
MinedMap / test (ubuntu-latest) (push) Has been cancelled
MinedMap / test (windows-latest) (push) Has been cancelled
MinedMap / build (.exe, windows-2019, i686-pc-windows-msvc) (push) Has been cancelled
MinedMap / build (.exe, windows-2019, x86_64-pc-windows-msvc) (push) Has been cancelled
MinedMap / build (macos-13, aarch64-apple-darwin) (push) Has been cancelled
MinedMap / build (macos-13, x86_64-apple-darwin) (push) Has been cancelled
MinedMap / build (ubuntu-22.04, x86_64-unknown-linux-gnu) (push) Has been cancelled
MinedMap / build-container (push) Has been cancelled
MinedMap / viewer-container (push) Has been cancelled
Update to Rust 1.86, make TextValue handling more correct
2025-04-03 19:00:14 +02:00
ca880ab3b4
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.
2025-04-03 18:52:39 +02:00
dd56e842b5
ci: update to Rust 1.86
There is no official 1.86 Docker image yet.
2025-04-03 18:52:33 +02:00
69b62576ea
world/chunk: fix new Rust 1.86 clippy warning 2025-04-03 18:37:54 +02:00
4 changed files with 19 additions and 14 deletions

View file

@ -48,7 +48,7 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master - uses: dtolnay/rust-toolchain@master
with: with:
toolchain: '1.85.1' toolchain: '1.86'
components: rustfmt components: rustfmt
- run: cargo fmt --all -- --check - run: cargo fmt --all -- --check
@ -58,7 +58,7 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master - uses: dtolnay/rust-toolchain@master
with: with:
toolchain: '1.85.1' toolchain: '1.86'
components: clippy components: clippy
- uses: swatinem/rust-cache@v2 - uses: swatinem/rust-cache@v2
- uses: actions-rs/clippy-check@v1 - uses: actions-rs/clippy-check@v1
@ -72,7 +72,7 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master - uses: dtolnay/rust-toolchain@master
with: with:
toolchain: '1.85.1' toolchain: '1.86'
components: rust-docs components: rust-docs
- uses: swatinem/rust-cache@v2 - uses: swatinem/rust-cache@v2
- run: cargo doc --workspace --no-deps --document-private-items - run: cargo doc --workspace --no-deps --document-private-items
@ -87,7 +87,7 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master - uses: dtolnay/rust-toolchain@master
with: with:
toolchain: '1.85.1' toolchain: '1.86'
- uses: swatinem/rust-cache@v2 - uses: swatinem/rust-cache@v2
- run: cargo test --workspace - run: cargo test --workspace
- run: cargo test --workspace --no-default-features - run: cargo test --workspace --no-default-features
@ -127,7 +127,7 @@ jobs:
- uses: dtolnay/rust-toolchain@master - uses: dtolnay/rust-toolchain@master
with: with:
toolchain: '1.85.1' toolchain: '1.86'
targets: '${{ matrix.target }}' targets: '${{ matrix.target }}'
- uses: swatinem/rust-cache@v2 - uses: swatinem/rust-cache@v2

View file

@ -48,7 +48,7 @@ pub const MIPMAP_FILE_META_VERSION: FileMetaVersion = FileMetaVersion(0);
/// MinedMap processed entity data version number /// MinedMap processed entity data version number
/// ///
/// Increase when entity collection changes bacause of code changes. /// 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 /// Coordinate pair of a generated tile
/// ///

View file

@ -419,7 +419,7 @@ impl<'a> Iterator for SectionIter<'a> {
} }
fn last(mut self) -> Option<Self::Item> { fn last(mut self) -> Option<Self::Item> {
self.with_iter(|iter| iter.last()) self.next_back()
} }
} }

View file

@ -176,15 +176,20 @@ pub struct TextValue(pub fastnbt::Value);
impl TextValue { impl TextValue {
/// Deserializes a [TextValue] into a [DeserializedText] /// Deserializes a [TextValue] into a [DeserializedText]
pub fn deserialize(&self, data_version: u32) -> 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 data_version < 4290 {
if let fastnbt::Value::String(json) = &self.0 { let fastnbt::Value::String(json) = &self.0 else {
if let Ok(content) = serde_json::from_str(json) { return DeserializedText::default();
return content; };
}
}
}
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()
}
} }
} }