diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2026-01-13 10:51:45 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-13 10:51:45 -0600 |
| commit | b21ac946cafaacc9ee2478ea48ed9e72554f79ed (patch) | |
| tree | 4d05744b9801e94f5da6563d8fabddfb20d1c7b7 /azalea-inventory/src | |
| parent | d5fa5e32b37754b3b5c136e58821e48cd3b7c2ff (diff) | |
| download | azalea-drasl-b21ac946cafaacc9ee2478ea48ed9e72554f79ed.tar.xz | |
Merge AzaleaRead and AzaleaWrite (#305)
Diffstat (limited to 'azalea-inventory/src')
| -rw-r--r-- | azalea-inventory/src/components/mod.rs | 4 | ||||
| -rw-r--r-- | azalea-inventory/src/slot.rs | 12 |
2 files changed, 5 insertions, 11 deletions
diff --git a/azalea-inventory/src/components/mod.rs b/azalea-inventory/src/components/mod.rs index 5e055592..3d13725a 100644 --- a/azalea-inventory/src/components/mod.rs +++ b/azalea-inventory/src/components/mod.rs @@ -9,7 +9,7 @@ use std::{ mem::ManuallyDrop, }; -use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite, BufReadError}; +use azalea_buf::{AzBuf, BufReadError}; use azalea_chat::FormattedText; use azalea_core::{ attribute_modifier_operation::AttributeModifierOperation, @@ -54,7 +54,7 @@ pub trait EncodableDataComponent: Send + Sync + Any { impl<T> EncodableDataComponent for T where - T: DataComponentTrait + Clone + AzaleaWrite + AzaleaRead + PartialEq, + T: DataComponentTrait + Clone + AzBuf + PartialEq, { fn encode(&self, buf: &mut Vec<u8>) -> io::Result<()> { self.azalea_write(buf) diff --git a/azalea-inventory/src/slot.rs b/azalea-inventory/src/slot.rs index 92dd40b1..c06ac71a 100644 --- a/azalea-inventory/src/slot.rs +++ b/azalea-inventory/src/slot.rs @@ -5,7 +5,7 @@ use std::{ io::{self, Cursor, Write}, }; -use azalea_buf::{AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError}; +use azalea_buf::{AzBuf, AzBufVar, BufReadError}; use azalea_core::codec_utils::is_default; use azalea_registry::builtin::{DataComponentKind, ItemKind}; use indexmap::IndexMap; @@ -216,7 +216,7 @@ impl ItemStackData { } } -impl AzaleaRead for ItemStack { +impl AzBuf for ItemStack { fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { let count = i32::azalea_read_var(buf)?; if count <= 0 { @@ -231,9 +231,6 @@ impl AzaleaRead for ItemStack { })) } } -} - -impl AzaleaWrite for ItemStack { fn azalea_write(&self, buf: &mut impl Write) -> io::Result<()> { match self { ItemStack::Empty => 0_i32.azalea_write_var(buf)?, @@ -380,7 +377,7 @@ impl Drop for DataComponentPatch { } } -impl AzaleaRead for DataComponentPatch { +impl AzBuf for DataComponentPatch { fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { let components_with_data_count = u32::azalea_read_var(buf)?; let components_without_data_count = u32::azalea_read_var(buf)?; @@ -407,9 +404,6 @@ impl AzaleaRead for DataComponentPatch { Ok(components) } -} - -impl AzaleaWrite for DataComponentPatch { fn azalea_write(&self, buf: &mut impl Write) -> io::Result<()> { let mut components_with_data_count: u32 = 0; let mut components_without_data_count: u32 = 0; |
