aboutsummaryrefslogtreecommitdiff
path: root/azalea-world/src/chunk_storage.rs
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2024-11-27 19:31:40 -0600
committerGitHub <noreply@github.com>2024-11-27 19:31:40 -0600
commit08958c2278b15ebeac8a964f392ebb792e479b61 (patch)
tree4ae3664cea38d7fd1a8f1e95ed06fac04ffe519e /azalea-world/src/chunk_storage.rs
parent139d77d3c2b0922fba5e9d4fa2bd9819d78bd773 (diff)
downloadazalea-drasl-08958c2278b15ebeac8a964f392ebb792e479b61.tar.xz
Refactor azalea-protocol (#190)
* start updating to 1.21.4 * fix block codegen and stop using block data from burger * rename packet related modules and structs to be simpler * ItemSlot -> ItemStack for more consistency with mojmap * .get() -> .into_packet() * simplify declare_state_packets by removing packet ids * rename read_from and write_into to azalea_read and azalea_write * rename McBufReadable and McBufWritable to AzaleaRead and AzaleaWrite * McBuf -> AzBuf * remove most uses of into_variant * update codegen and use resourcelocation names for packets * implement #[limit(i)] attribute for AzBuf derive macro * fixes for 1.21.4 * fix examples * update some physics code and fix ChatType * remove unused imports in codegen * re-add some things to migrate.py and update +mc version numbers automatically * downgrade to 1.21.3 lol
Diffstat (limited to 'azalea-world/src/chunk_storage.rs')
-rwxr-xr-xazalea-world/src/chunk_storage.rs26
1 files changed, 13 insertions, 13 deletions
diff --git a/azalea-world/src/chunk_storage.rs b/azalea-world/src/chunk_storage.rs
index 1709a903..7eb10471 100755
--- a/azalea-world/src/chunk_storage.rs
+++ b/azalea-world/src/chunk_storage.rs
@@ -8,7 +8,7 @@ use std::{
};
use azalea_block::BlockState;
-use azalea_buf::{BufReadError, McBufReadable, McBufWritable};
+use azalea_buf::{AzaleaRead, AzaleaWrite, BufReadError};
use azalea_core::position::{BlockPos, ChunkBlockPos, ChunkPos, ChunkSectionBlockPos};
use nohash_hasher::IntMap;
use parking_lot::RwLock;
@@ -332,7 +332,7 @@ impl Chunk {
let section_count = dimension_height / SECTION_HEIGHT;
let mut sections = Vec::with_capacity(section_count as usize);
for _ in 0..section_count {
- let section = Section::read_from(buf)?;
+ let section = Section::azalea_read(buf)?;
sections.push(section);
}
@@ -416,10 +416,10 @@ pub fn get_block_state_from_sections(
Some(section.get(chunk_section_pos))
}
-impl McBufWritable for Chunk {
- fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> {
+impl AzaleaWrite for Chunk {
+ fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> {
for section in &self.sections {
- section.write_into(buf)?;
+ section.azalea_write(buf)?;
}
Ok(())
}
@@ -437,9 +437,9 @@ impl Debug for PartialChunkStorage {
}
}
-impl McBufReadable for Section {
- fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> {
- let block_count = u16::read_from(buf)?;
+impl AzaleaRead for Section {
+ fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> {
+ let block_count = u16::azalea_read(buf)?;
// this is commented out because the vanilla server is wrong
// assert!(
@@ -467,11 +467,11 @@ impl McBufReadable for Section {
}
}
-impl McBufWritable for Section {
- fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> {
- self.block_count.write_into(buf)?;
- self.states.write_into(buf)?;
- self.biomes.write_into(buf)?;
+impl AzaleaWrite for Section {
+ fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> {
+ self.block_count.azalea_write(buf)?;
+ self.states.azalea_write(buf)?;
+ self.biomes.azalea_write(buf)?;
Ok(())
}
}