diff options
| author | mat <git@matdoes.dev> | 2026-02-22 18:38:25 -0900 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2026-02-22 18:38:25 -0900 |
| commit | 8fd11c174d921a8085bb7e67ae62958e23d174cb (patch) | |
| tree | a760a1e34f24c1429370ea807a29bd60668d2a58 /azalea-world/src/palette | |
| parent | 341e99403b3b215a4ef09b02c0bd9ee40ac4205f (diff) | |
| download | azalea-drasl-8fd11c174d921a8085bb7e67ae62958e23d174cb.tar.xz | |
fix incorrect PalettedContainer::write impl
Diffstat (limited to 'azalea-world/src/palette')
| -rw-r--r-- | azalea-world/src/palette/container.rs | 11 | ||||
| -rw-r--r-- | azalea-world/src/palette/mod.rs | 2 |
2 files changed, 9 insertions, 4 deletions
diff --git a/azalea-world/src/palette/container.rs b/azalea-world/src/palette/container.rs index 4e4e5595..43262a3d 100644 --- a/azalea-world/src/palette/container.rs +++ b/azalea-world/src/palette/container.rs @@ -12,7 +12,7 @@ use tracing::{debug, warn}; use super::{Palette, PaletteKind}; use crate::BitStorage; -#[derive(Clone, Debug)] +#[derive(Clone, Debug, PartialEq)] pub struct PalettedContainer<S: PalletedContainerKind> { pub bits_per_entry: u8, /// This is usually a list of unique values that appear in the container so @@ -25,7 +25,9 @@ pub struct PalettedContainer<S: PalletedContainerKind> { pub storage: BitStorage, } -pub trait PalletedContainerKind: Copy + Clone + Debug + Default + TryFrom<u32> + Into<u32> { +pub trait PalletedContainerKind: + Copy + Clone + Debug + Default + PartialEq + TryFrom<u32> + Into<u32> +{ type SectionPos: SectionPos; fn size_bits() -> usize; @@ -295,7 +297,10 @@ impl<S: PalletedContainerKind> PalettedContainer<S> { pub fn write(&self, buf: &mut impl Write) -> io::Result<()> { self.bits_per_entry.azalea_write(buf)?; self.palette.write(buf)?; - self.storage.data.azalea_write(buf)?; + for word in &self.storage.data { + word.azalea_write(buf)?; + } + Ok(()) } } diff --git a/azalea-world/src/palette/mod.rs b/azalea-world/src/palette/mod.rs index 11b38f45..067c68c4 100644 --- a/azalea-world/src/palette/mod.rs +++ b/azalea-world/src/palette/mod.rs @@ -12,7 +12,7 @@ use azalea_buf::{AzBufVar, BufReadError}; pub use container::*; /// A representation of the different types of chunk palettes Minecraft uses. -#[derive(Clone, Debug)] +#[derive(Clone, Debug, PartialEq)] pub enum Palette<S: PalletedContainerKind> { /// ID of the corresponding entry in its global palette SingleValue(S), |
