aboutsummaryrefslogtreecommitdiff
path: root/azalea-brigadier/src
diff options
context:
space:
mode:
Diffstat (limited to 'azalea-brigadier/src')
-rwxr-xr-xazalea-brigadier/src/suggestion/mod.rs10
-rwxr-xr-xazalea-brigadier/src/suggestion/suggestions.rs28
2 files changed, 18 insertions, 20 deletions
diff --git a/azalea-brigadier/src/suggestion/mod.rs b/azalea-brigadier/src/suggestion/mod.rs
index 753b1bc8..a31b6837 100755
--- a/azalea-brigadier/src/suggestion/mod.rs
+++ b/azalea-brigadier/src/suggestion/mod.rs
@@ -9,7 +9,7 @@ use std::{
};
#[cfg(feature = "azalea-buf")]
-use azalea_buf::McBufWritable;
+use azalea_buf::AzaleaWrite;
#[cfg(feature = "azalea-buf")]
use azalea_chat::FormattedText;
pub use suggestions::Suggestions;
@@ -137,13 +137,13 @@ impl PartialOrd for SuggestionValue {
}
#[cfg(feature = "azalea-buf")]
-impl McBufWritable for Suggestion {
- fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> {
- self.value.to_string().write_into(buf)?;
+impl AzaleaWrite for Suggestion {
+ fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> {
+ self.value.to_string().azalea_write(buf)?;
self.tooltip
.clone()
.map(FormattedText::from)
- .write_into(buf)?;
+ .azalea_write(buf)?;
Ok(())
}
}
diff --git a/azalea-brigadier/src/suggestion/suggestions.rs b/azalea-brigadier/src/suggestion/suggestions.rs
index 5941aa7d..60eaa111 100755
--- a/azalea-brigadier/src/suggestion/suggestions.rs
+++ b/azalea-brigadier/src/suggestion/suggestions.rs
@@ -3,9 +3,7 @@ use std::io::{Cursor, Write};
use std::{collections::HashSet, hash::Hash};
#[cfg(feature = "azalea-buf")]
-use azalea_buf::{
- BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable,
-};
+use azalea_buf::{AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError};
#[cfg(feature = "azalea-buf")]
use azalea_chat::FormattedText;
@@ -79,21 +77,21 @@ impl Suggestions {
}
#[cfg(feature = "azalea-buf")]
-impl McBufReadable for Suggestions {
- fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> {
- #[derive(McBuf)]
+impl AzaleaRead for Suggestions {
+ fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> {
+ #[derive(AzBuf)]
struct StandaloneSuggestion {
pub text: String,
pub tooltip: Option<FormattedText>,
}
- let start = u32::var_read_from(buf)? as usize;
- let length = u32::var_read_from(buf)? as usize;
+ let start = u32::azalea_read_var(buf)? as usize;
+ let length = u32::azalea_read_var(buf)? as usize;
let range = StringRange::between(start, start + length);
// the range of a Suggestion depends on the Suggestions containing it,
- // so we can't just `impl McBufReadable for Suggestion`
- let mut suggestions = Vec::<StandaloneSuggestion>::read_from(buf)?
+ // so we can't just `impl AzaleaRead for Suggestion`
+ let mut suggestions = Vec::<StandaloneSuggestion>::azalea_read(buf)?
.into_iter()
.map(|s| Suggestion {
value: SuggestionValue::Text(s.text),
@@ -108,11 +106,11 @@ impl McBufReadable for Suggestions {
}
#[cfg(feature = "azalea-buf")]
-impl McBufWritable for Suggestions {
- fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> {
- (self.range.start() as u32).var_write_into(buf)?;
- (self.range.length() as u32).var_write_into(buf)?;
- self.suggestions.write_into(buf)?;
+impl AzaleaWrite for Suggestions {
+ fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> {
+ (self.range.start() as u32).azalea_write_var(buf)?;
+ (self.range.length() as u32).azalea_write_var(buf)?;
+ self.suggestions.azalea_write(buf)?;
Ok(())
}
}