mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 14:26:04 +00:00
serverbound hello packet
This commit is contained in:
parent
ee86d766a8
commit
ac404bd08e
4 changed files with 43 additions and 4 deletions
|
@ -1,5 +1,6 @@
|
|||
use azalea_buf::McBuf;
|
||||
use azalea_protocol_macros::ClientboundGamePacket;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
|
||||
pub struct ClientboundPlayerInfoRemovePacket {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use azalea_buf::McBuf;
|
||||
use azalea_core::ResourceLocation;
|
||||
use azalea_protocol_macros::ClientboundGamePacket;
|
||||
|
||||
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
|
||||
|
|
|
@ -2,10 +2,46 @@ use azalea_buf::McBuf;
|
|||
use azalea_protocol_macros::ServerboundLoginPacket;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Clone, Debug, McBuf, ServerboundLoginPacket)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, McBuf, ServerboundLoginPacket)]
|
||||
pub struct ServerboundHelloPacket {
|
||||
pub name: String,
|
||||
// TODO: {'field': 'b.b', 'operation': 'write', 'type': 'uuid'}
|
||||
pub chat_session: Option<(u64, u32, Vec<u8>, u32, Vec<u8>)>,
|
||||
pub chat_session: RemoteChatSessionData,
|
||||
pub profile_id: Option<Uuid>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, McBuf)]
|
||||
pub struct RemoteChatSessionData {
|
||||
pub session_id: Uuid,
|
||||
pub profile_public_key: Option<ProfilePublicKeyData>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, McBuf, PartialEq, Eq)]
|
||||
pub struct ProfilePublicKeyData {
|
||||
pub expires_at: u64,
|
||||
pub key: Vec<u8>,
|
||||
pub key_signature: Vec<u8>,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::io::Cursor;
|
||||
|
||||
use super::*;
|
||||
use azalea_buf::{McBufReadable, McBufWritable};
|
||||
|
||||
#[test]
|
||||
fn test_read_write() {
|
||||
let packet = ServerboundHelloPacket {
|
||||
name: "test".to_string(),
|
||||
chat_session: RemoteChatSessionData {
|
||||
session_id: Uuid::default(),
|
||||
profile_public_key: None,
|
||||
},
|
||||
profile_id: Some(Uuid::from_u128(0)),
|
||||
};
|
||||
let mut buf: Vec<u8> = Vec::new();
|
||||
packet.write_into(&mut buf).unwrap();
|
||||
let packet2 = ServerboundHelloPacket::read_from(&mut Cursor::new(&buf)).unwrap();
|
||||
assert_eq!(packet, packet2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -244,9 +244,10 @@ def burger_instruction_to_code(instructions: list[dict], index: int, generated_p
|
|||
# figure out what kind of iterator it is
|
||||
loop_instructions = next_next_instruction['instructions']
|
||||
if len(loop_instructions) == 2:
|
||||
entry_type_rs, is_var, uses, extra_code = burger_type_to_rust_type(
|
||||
entry_type_rs, is_var, value_uses, extra_code = burger_type_to_rust_type(
|
||||
loop_instructions[1]['type'], None, loop_instructions[1], mappings, obfuscated_class_name)
|
||||
field_type_rs = f'Vec<{entry_type_rs}>'
|
||||
uses.update(value_uses)
|
||||
elif len(loop_instructions) == 3:
|
||||
is_map = loop_instructions[0]['type'].startswith(
|
||||
'Map.Entry<')
|
||||
|
|
Loading…
Add table
Reference in a new issue