aboutsummaryrefslogtreecommitdiff
path: root/azalea-world/src
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2026-01-13 10:51:45 -0600
committerGitHub <noreply@github.com>2026-01-13 10:51:45 -0600
commitb21ac946cafaacc9ee2478ea48ed9e72554f79ed (patch)
tree4d05744b9801e94f5da6563d8fabddfb20d1c7b7 /azalea-world/src
parentd5fa5e32b37754b3b5c136e58821e48cd3b7c2ff (diff)
downloadazalea-drasl-b21ac946cafaacc9ee2478ea48ed9e72554f79ed.tar.xz
Merge AzaleaRead and AzaleaWrite (#305)
Diffstat (limited to 'azalea-world/src')
-rw-r--r--azalea-world/src/chunk_storage.rs27
-rw-r--r--azalea-world/src/palette/container.rs8
-rw-r--r--azalea-world/src/palette/mod.rs6
3 files changed, 19 insertions, 22 deletions
diff --git a/azalea-world/src/chunk_storage.rs b/azalea-world/src/chunk_storage.rs
index 3f8c4e2d..0ad96c81 100644
--- a/azalea-world/src/chunk_storage.rs
+++ b/azalea-world/src/chunk_storage.rs
@@ -11,7 +11,7 @@ use azalea_block::{
block_state::{BlockState, BlockStateIntegerRepr},
fluid_state::FluidState,
};
-use azalea_buf::{AzaleaRead, AzaleaWrite, BufReadError};
+use azalea_buf::{AzBuf, BufReadError};
use azalea_core::{
heightmap_kind::HeightmapKind,
position::{
@@ -461,14 +461,14 @@ pub fn get_block_state_from_sections(
Some(section.get_block_state(chunk_section_pos))
}
-impl AzaleaWrite for Chunk {
- fn azalea_write(&self, buf: &mut impl Write) -> io::Result<()> {
- for section in &self.sections {
- section.azalea_write(buf)?;
- }
- Ok(())
- }
-}
+// impl AzBuf for Chunk {
+// fn azalea_write(&self, buf: &mut impl Write) -> io::Result<()> {
+// for section in &self.sections {
+// section.azalea_write(buf)?;
+// }
+// Ok(())
+// }
+// }
impl Debug for PartialChunkStorage {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
@@ -482,7 +482,7 @@ impl Debug for PartialChunkStorage {
}
}
-impl AzaleaRead for Section {
+impl AzBuf for Section {
fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> {
let block_count = u16::azalea_read(buf)?;
@@ -511,13 +511,10 @@ impl AzaleaRead for Section {
biomes,
})
}
-}
-
-impl AzaleaWrite for Section {
fn azalea_write(&self, buf: &mut impl Write) -> io::Result<()> {
self.block_count.azalea_write(buf)?;
- self.states.azalea_write(buf)?;
- self.biomes.azalea_write(buf)?;
+ self.states.write(buf)?;
+ self.biomes.write(buf)?;
Ok(())
}
}
diff --git a/azalea-world/src/palette/container.rs b/azalea-world/src/palette/container.rs
index a6c7454b..4e4e5595 100644
--- a/azalea-world/src/palette/container.rs
+++ b/azalea-world/src/palette/container.rs
@@ -4,7 +4,7 @@ use std::{
};
use azalea_block::BlockState;
-use azalea_buf::{AzaleaRead, AzaleaWrite, BufReadError};
+use azalea_buf::{AzBuf, BufReadError};
use azalea_core::position::{ChunkSectionBiomePos, ChunkSectionBlockPos};
use azalea_registry::data::Biome;
use tracing::{debug, warn};
@@ -291,10 +291,10 @@ impl<S: PalletedContainerKind> PalettedContainer<S> {
}
}
-impl<S: PalletedContainerKind> AzaleaWrite for PalettedContainer<S> {
- fn azalea_write(&self, buf: &mut impl Write) -> io::Result<()> {
+impl<S: PalletedContainerKind> PalettedContainer<S> {
+ pub fn write(&self, buf: &mut impl Write) -> io::Result<()> {
self.bits_per_entry.azalea_write(buf)?;
- self.palette.azalea_write(buf)?;
+ self.palette.write(buf)?;
self.storage.data.azalea_write(buf)?;
Ok(())
}
diff --git a/azalea-world/src/palette/mod.rs b/azalea-world/src/palette/mod.rs
index 4cbf690b..11b38f45 100644
--- a/azalea-world/src/palette/mod.rs
+++ b/azalea-world/src/palette/mod.rs
@@ -8,7 +8,7 @@ use std::{
io::{self, Cursor, Write},
};
-use azalea_buf::{AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError};
+use azalea_buf::{AzBufVar, BufReadError};
pub use container::*;
/// A representation of the different types of chunk palettes Minecraft uses.
@@ -34,8 +34,8 @@ impl<S: PalletedContainerKind> Palette<S> {
}
}
-impl<S: PalletedContainerKind> AzaleaWrite for Palette<S> {
- fn azalea_write(&self, buf: &mut impl Write) -> io::Result<()> {
+impl<S: PalletedContainerKind> Palette<S> {
+ pub fn write(&self, buf: &mut impl Write) -> io::Result<()> {
match self {
Palette::SingleValue(value) => {
(*value).into().azalea_write_var(buf)?;