mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 14:26:04 +00:00
1.19.1-rc2
This commit is contained in:
parent
ec0b6ec06c
commit
c0ca03204f
9 changed files with 67 additions and 24 deletions
|
@ -7,7 +7,7 @@ A collection of Rust crates primarily for creating Minecraft bots.
|
|||
</p>
|
||||
|
||||
<!-- The line below is automatically read and updated by the migrate script, so don't change it manually. -->
|
||||
*Currently supported Minecraft version: `1.19.1-pre4`.*
|
||||
*Currently supported Minecraft version: `1.19.1-rc2`.*
|
||||
|
||||
I named this Azalea because it sounds like a cool word and this is a cool library. This project was heavily inspired by PrismarineJS.
|
||||
|
||||
|
|
|
@ -15,5 +15,5 @@ pub struct MessageSignature {
|
|||
#[derive(Clone, Debug, McBuf)]
|
||||
pub struct SignedMessageHeader {
|
||||
pub previous_signature: Option<MessageSignature>,
|
||||
pub uuid: Uuid,
|
||||
pub sender: Uuid,
|
||||
}
|
||||
|
|
|
@ -17,7 +17,8 @@ pub enum ChatType {
|
|||
MsgCommandIncoming = 2,
|
||||
MsgCommandOutgoing = 3,
|
||||
TeamMsgCommandIncoming = 4,
|
||||
EmoteCommand = 5,
|
||||
TeamMsgCommandOutgoing = 5,
|
||||
EmoteCommand = 6,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, McBuf)]
|
||||
|
@ -37,14 +38,27 @@ pub struct PlayerChatMessage {
|
|||
|
||||
#[derive(Clone, Debug, McBuf)]
|
||||
pub struct SignedMessageBody {
|
||||
pub content: Component,
|
||||
pub content: ChatMessageContent,
|
||||
pub timestamp: u64,
|
||||
pub salt: u64,
|
||||
pub last_seen: Vec<LastSeen>,
|
||||
pub last_seen: Vec<LastSeenMessagesEntry>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, McBuf)]
|
||||
pub struct LastSeen {
|
||||
pub struct LastSeenMessagesEntry {
|
||||
pub profile_id: Uuid,
|
||||
pub last_signature: MessageSignature,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, McBuf)]
|
||||
pub struct LastSeenMessagesUpdate {
|
||||
pub last_seen: Vec<LastSeenMessagesEntry>,
|
||||
pub last_received: Option<LastSeenMessagesEntry>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, McBuf)]
|
||||
pub struct ChatMessageContent {
|
||||
pub plain: String,
|
||||
/// Only sent if the decorated message is different than the plain.
|
||||
pub decorated: Option<Component>,
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
use azalea_buf::McBuf;
|
||||
use azalea_chat::component::Component;
|
||||
use packet_macros::GamePacket;
|
||||
|
||||
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||
|
@ -7,4 +6,5 @@ pub struct ClientboundServerDataPacket {
|
|||
pub motd: Option<Component>,
|
||||
pub icon_base64: Option<String>,
|
||||
pub previews_chat: bool,
|
||||
pub enforces_secure_chat: bool,
|
||||
}
|
||||
|
|
|
@ -54,7 +54,9 @@ pub mod clientbound_update_recipes_packet;
|
|||
pub mod clientbound_update_tags_packet;
|
||||
pub mod clientbound_update_view_distance_packet;
|
||||
pub mod serverbound_accept_teleportation_packet;
|
||||
pub mod serverbound_chat_ack_packet;
|
||||
pub mod serverbound_chat_command_packet;
|
||||
pub mod serverbound_chat_packet;
|
||||
pub mod serverbound_chat_preview_packet;
|
||||
pub mod serverbound_custom_payload_packet;
|
||||
pub mod serverbound_keep_alive_packet;
|
||||
|
@ -69,14 +71,16 @@ declare_state_packets!(
|
|||
GamePacket,
|
||||
Serverbound => {
|
||||
0x00: serverbound_accept_teleportation_packet::ServerboundAcceptTeleportationPacket,
|
||||
0x03: serverbound_chat_command_packet::ServerboundChatCommandPacket,
|
||||
0x05: serverbound_chat_preview_packet::ServerboundChatPreviewPacket,
|
||||
0x0c: serverbound_custom_payload_packet::ServerboundCustomPayloadPacket,
|
||||
0x11: serverbound_keep_alive_packet::ServerboundKeepAlivePacket,
|
||||
0x13: serverbound_move_player_packet_pos::ServerboundMovePlayerPacketPos,
|
||||
0x14: serverbound_move_player_packet_pos_rot::ServerboundMovePlayerPacketPosRot,
|
||||
0x15: serverbound_move_player_packet_rot::ServerboundMovePlayerPacketRot,
|
||||
0x16: serverbound_move_player_packet_status_only::ServerboundMovePlayerPacketStatusOnly,
|
||||
0x03: serverbound_chat_ack_packet::ServerboundChatAckPacket,
|
||||
0x04: serverbound_chat_command_packet::ServerboundChatCommandPacket,
|
||||
0x05: serverbound_chat_packet::ServerboundChatPacket,
|
||||
0x06: serverbound_chat_preview_packet::ServerboundChatPreviewPacket,
|
||||
0x0d: serverbound_custom_payload_packet::ServerboundCustomPayloadPacket,
|
||||
0x12: serverbound_keep_alive_packet::ServerboundKeepAlivePacket,
|
||||
0x14: serverbound_move_player_packet_pos::ServerboundMovePlayerPacketPos,
|
||||
0x15: serverbound_move_player_packet_pos_rot::ServerboundMovePlayerPacketPosRot,
|
||||
0x16: serverbound_move_player_packet_rot::ServerboundMovePlayerPacketRot,
|
||||
0x17: serverbound_move_player_packet_status_only::ServerboundMovePlayerPacketStatusOnly,
|
||||
},
|
||||
Clientbound => {
|
||||
0x00: clientbound_add_entity_packet::ClientboundAddEntityPacket,
|
||||
|
@ -105,8 +109,8 @@ declare_state_packets!(
|
|||
0x29: clientbound_move_entity_posrot_packet::ClientboundMoveEntityPosrotPacket,
|
||||
0x2a: clientbound_move_entity_rot_packet::ClientboundMoveEntityRotPacket,
|
||||
0x31: clientbound_player_abilities_packet::ClientboundPlayerAbilitiesPacket,
|
||||
0x32: clientbound_player_chat_packet::ClientboundPlayerChatPacket,
|
||||
0x33: clientbound_player_chat_header_packet::ClientboundPlayerChatHeaderPacket,
|
||||
0x32: clientbound_player_chat_header_packet::ClientboundPlayerChatHeaderPacket,
|
||||
0x33: clientbound_player_chat_packet::ClientboundPlayerChatPacket,
|
||||
0x37: clientbound_player_info_packet::ClientboundPlayerInfoPacket,
|
||||
0x39: clientbound_player_position_packet::ClientboundPlayerPositionPacket,
|
||||
0x3a: clientbound_recipe_packet::ClientboundRecipePacket,
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
use crate::packets::game::clientbound_player_chat_packet::LastSeenUpdate;
|
||||
use azalea_buf::McBuf;
|
||||
use packet_macros::GamePacket;
|
||||
|
||||
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||
pub struct ServerboundChatAckPacket {
|
||||
pub last_seen_messages: LastSeenUpdate,
|
||||
}
|
|
@ -1,19 +1,22 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use azalea_buf::McBuf;
|
||||
use azalea_crypto::MessageSignature;
|
||||
use packet_macros::GamePacket;
|
||||
|
||||
use super::clientbound_player_chat_packet::LastSeenMessagesUpdate;
|
||||
|
||||
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||
pub struct ServerboundChatCommandPacket {
|
||||
pub command: String,
|
||||
// TODO: Choose a real timestamp type
|
||||
pub timestamp: u64,
|
||||
pub argument_signatures: ArgumentSignatures,
|
||||
pub salt: i64,
|
||||
pub argument_signatures: Vec<ArgumentSignature>,
|
||||
pub signed_preview: bool,
|
||||
pub last_seen_messages: LastSeenMessagesUpdate,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, McBuf)]
|
||||
pub struct ArgumentSignatures {
|
||||
pub salt: u64,
|
||||
pub signatures: HashMap<String, Vec<u8>>,
|
||||
pub struct ArgumentSignature {
|
||||
pub name: String,
|
||||
pub signature: MessageSignature,
|
||||
}
|
||||
|
|
14
azalea-protocol/src/packets/game/serverbound_chat_packet.rs
Normal file
14
azalea-protocol/src/packets/game/serverbound_chat_packet.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
use crate::packets::game::clientbound_player_chat_packet::LastSeenMessagesUpdate;
|
||||
use azalea_buf::McBuf;
|
||||
use azalea_crypto::MessageSignature;
|
||||
use packet_macros::GamePacket;
|
||||
|
||||
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||
pub struct ServerboundChatPacket {
|
||||
pub message: String,
|
||||
pub timestamp: u64,
|
||||
pub salt: u64,
|
||||
pub signature: MessageSignature,
|
||||
pub signed_preview: bool,
|
||||
pub last_seen_messages: LastSeenMessagesUpdate,
|
||||
}
|
|
@ -7,7 +7,7 @@ use crate::connect::PacketFlow;
|
|||
use azalea_buf::{McBufWritable, Readable, Writable};
|
||||
use std::io::{Read, Write};
|
||||
|
||||
pub const PROTOCOL_VERSION: u32 = 1073741921;
|
||||
pub const PROTOCOL_VERSION: u32 = 1073741924;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub enum ConnectionProtocol {
|
||||
|
|
Loading…
Add table
Reference in a new issue