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:
parent
9b50886c30
commit
1b5a3722ee
3 changed files with 2 additions and 12 deletions
|
@ -24,7 +24,6 @@ impl ClientboundDeclareCommandsPacket {
|
||||||
buf: &mut T,
|
buf: &mut T,
|
||||||
) -> Result<GamePacket, String> {
|
) -> Result<GamePacket, String> {
|
||||||
let node_count = buf.read_varint().await?;
|
let node_count = buf.read_varint().await?;
|
||||||
println!("node_count: {}", node_count);
|
|
||||||
let mut nodes = Vec::with_capacity(node_count as usize);
|
let mut nodes = Vec::with_capacity(node_count as usize);
|
||||||
for _ in 0..node_count {
|
for _ in 0..node_count {
|
||||||
let node = BrigadierNodeStub::read_into(buf).await?;
|
let node = BrigadierNodeStub::read_into(buf).await?;
|
||||||
|
@ -323,21 +322,17 @@ impl McBufReadable for BrigadierNodeStub {
|
||||||
let is_executable = flags & 0x04 != 0;
|
let is_executable = flags & 0x04 != 0;
|
||||||
let has_redirect = flags & 0x08 != 0;
|
let has_redirect = flags & 0x08 != 0;
|
||||||
let has_suggestions_type = flags & 0x10 != 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?;
|
let children = buf.read_int_id_list().await?;
|
||||||
println!("children: {:?}", children);
|
|
||||||
let redirect_node = if has_redirect {
|
let redirect_node = if has_redirect {
|
||||||
buf.read_varint().await?
|
buf.read_varint().await?
|
||||||
} else {
|
} else {
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
println!("redirect_node: {}", redirect_node);
|
|
||||||
|
|
||||||
// argument node
|
// argument node
|
||||||
if node_type == 2 {
|
if node_type == 2 {
|
||||||
let name = buf.read_utf().await?;
|
let name = buf.read_utf().await?;
|
||||||
println!("name: {}", name);
|
|
||||||
|
|
||||||
let parser = BrigadierParser::read_into(buf).await?;
|
let parser = BrigadierParser::read_into(buf).await?;
|
||||||
|
|
||||||
|
@ -346,19 +341,13 @@ impl McBufReadable for BrigadierNodeStub {
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
println!(
|
|
||||||
"node_type=2, flags={}, name={}, parser={:?}, suggestions_type={:?}",
|
|
||||||
flags, name, parser, suggestions_type
|
|
||||||
);
|
|
||||||
return Ok(BrigadierNodeStub {});
|
return Ok(BrigadierNodeStub {});
|
||||||
}
|
}
|
||||||
// literal node
|
// literal node
|
||||||
if node_type == 1 {
|
if node_type == 1 {
|
||||||
let name = buf.read_utf().await?;
|
let name = buf.read_utf().await?;
|
||||||
println!("node_type=1, flags={}, name={}", flags, name);
|
|
||||||
return Ok(BrigadierNodeStub {});
|
return Ok(BrigadierNodeStub {});
|
||||||
}
|
}
|
||||||
println!("node_type={}, flags={}", node_type, flags);
|
|
||||||
Ok(BrigadierNodeStub {})
|
Ok(BrigadierNodeStub {})
|
||||||
// return Err("Unknown node type".to_string());
|
// return Err("Unknown node type".to_string());
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ pub struct PlayerProperty {
|
||||||
#[derive(Clone, Debug, McBufReadable, McBufWritable)]
|
#[derive(Clone, Debug, McBufReadable, McBufWritable)]
|
||||||
pub struct AddPlayer {
|
pub struct AddPlayer {
|
||||||
uuid: Uuid,
|
uuid: Uuid,
|
||||||
|
name: String,
|
||||||
properties: Vec<PlayerProperty>,
|
properties: Vec<PlayerProperty>,
|
||||||
#[varint]
|
#[varint]
|
||||||
gamemode: u32,
|
gamemode: u32,
|
||||||
|
|
|
@ -3,7 +3,7 @@ async fn main() {
|
||||||
println!("Hello, world!");
|
println!("Hello, world!");
|
||||||
|
|
||||||
// let address = "95.111.249.143:10000";
|
// 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())
|
// let response = azalea_client::ping::ping_server(&address.try_into().unwrap())
|
||||||
// .await
|
// .await
|
||||||
// .unwrap();
|
// .unwrap();
|
||||||
|
|
Loading…
Add table
Reference in a new issue