1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 14:26:04 +00:00

fix player info packet

This commit is contained in:
mat 2022-04-27 23:35:34 -05:00
parent 9b50886c30
commit 1b5a3722ee
3 changed files with 2 additions and 12 deletions

View file

@ -24,7 +24,6 @@ impl ClientboundDeclareCommandsPacket {
buf: &mut T,
) -> Result<GamePacket, String> {
let node_count = buf.read_varint().await?;
println!("node_count: {}", node_count);
let mut nodes = Vec::with_capacity(node_count as usize);
for _ in 0..node_count {
let node = BrigadierNodeStub::read_into(buf).await?;
@ -323,21 +322,17 @@ impl McBufReadable for BrigadierNodeStub {
let is_executable = flags & 0x04 != 0;
let has_redirect = flags & 0x08 != 0;
let has_suggestions_type = flags & 0x10 != 0;
println!("flags: {}, node_type: {}, is_executable: {}, has_redirect: {}, has_suggestions_type: {}", flags, node_type, is_executable, has_redirect, has_suggestions_type);
let children = buf.read_int_id_list().await?;
println!("children: {:?}", children);
let redirect_node = if has_redirect {
buf.read_varint().await?
} else {
0
};
println!("redirect_node: {}", redirect_node);
// argument node
if node_type == 2 {
let name = buf.read_utf().await?;
println!("name: {}", name);
let parser = BrigadierParser::read_into(buf).await?;
@ -346,19 +341,13 @@ impl McBufReadable for BrigadierNodeStub {
} else {
None
};
println!(
"node_type=2, flags={}, name={}, parser={:?}, suggestions_type={:?}",
flags, name, parser, suggestions_type
);
return Ok(BrigadierNodeStub {});
}
// literal node
if node_type == 1 {
let name = buf.read_utf().await?;
println!("node_type=1, flags={}, name={}", flags, name);
return Ok(BrigadierNodeStub {});
}
println!("node_type={}, flags={}", node_type, flags);
Ok(BrigadierNodeStub {})
// return Err("Unknown node type".to_string());
}

View file

@ -31,6 +31,7 @@ pub struct PlayerProperty {
#[derive(Clone, Debug, McBufReadable, McBufWritable)]
pub struct AddPlayer {
uuid: Uuid,
name: String,
properties: Vec<PlayerProperty>,
#[varint]
gamemode: u32,

View file

@ -3,7 +3,7 @@ async fn main() {
println!("Hello, world!");
// let address = "95.111.249.143:10000";
let address = "localhost:53810";
let address = "localhost:63097";
// let response = azalea_client::ping::ping_server(&address.try_into().unwrap())
// .await
// .unwrap();