aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol/src/packets
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2022-10-23 19:00:24 -0500
committerGitHub <noreply@github.com>2022-10-23 19:00:24 -0500
commit65da123631b0a2dc078786f60fa6b213e8b430ee (patch)
tree8854f29c4240d36bec1710ebc2293a488c495d3d /azalea-protocol/src/packets
parent587001724acf8a7c6de30927da31c1f5fd7fdb09 (diff)
downloadazalea-drasl-65da123631b0a2dc078786f60fa6b213e8b430ee.tar.xz
Add Client::set_client_information (#33)
* start adding options * add default options * send options packet by default * mention set_options in Client::join doc * make TranslatableComponent::read return TextComponent * change set_options to set_client_information * clean up some code * Add `Initialize` event * fix some clippy warnings * change `Client::options` to `client_information`
Diffstat (limited to 'azalea-protocol/src/packets')
-rw-r--r--azalea-protocol/src/packets/game/serverbound_client_information_packet.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/azalea-protocol/src/packets/game/serverbound_client_information_packet.rs b/azalea-protocol/src/packets/game/serverbound_client_information_packet.rs
index 0c1ab14b..61fcbfbe 100644
--- a/azalea-protocol/src/packets/game/serverbound_client_information_packet.rs
+++ b/azalea-protocol/src/packets/game/serverbound_client_information_packet.rs
@@ -3,20 +3,48 @@ use azalea_protocol_macros::ServerboundGamePacket;
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
pub struct ServerboundClientInformationPacket {
+ /// The locale of the client.
pub language: String,
+ /// The view distance of the client in chunks, same as the render distance
+ /// in-game.
pub view_distance: u8,
+ /// The types of chat messages the client wants to receive. Note that many
+ /// servers ignore this.
pub chat_visibility: ChatVisibility,
+ /// Whether the messages sent from the server should have colors. Note that
+ /// many servers ignore this and always send colored messages.
pub chat_colors: bool,
pub model_customisation: u8,
pub main_hand: HumanoidArm,
pub text_filtering_enabled: bool,
+ /// Whether the client should show up as "Anonymous Player" in the server
+ /// list.
pub allows_listing: bool,
}
+impl Default for ServerboundClientInformationPacket {
+ fn default() -> Self {
+ Self {
+ language: "en_us".to_string(),
+ view_distance: 8,
+ chat_visibility: ChatVisibility::Full,
+ chat_colors: true,
+ model_customisation: 0,
+ main_hand: HumanoidArm::Right,
+ text_filtering_enabled: false,
+ allows_listing: false,
+ }
+ }
+}
+
#[derive(McBuf, Clone, Copy, Debug)]
pub enum ChatVisibility {
+ /// All chat messages should be sent to the client.
Full = 0,
+ /// Chat messages from other players should be not sent to the client, only
+ /// messages from the server like "Player joined the game" should be sent.
System = 1,
+ /// No chat messages should be sent to the client.
Hidden = 2,
}