From f235c9d064fbb2cc7d51a0c921ee632103dd9567 Mon Sep 17 00:00:00 2001 From: mat Date: Sat, 29 Oct 2022 13:54:19 -0500 Subject: [PATCH 01/18] don't panic if connection closes on join --- azalea-client/src/client.rs | 83 +++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 45 deletions(-) diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs index 2ca92354..05461f0f 100644 --- a/azalea-client/src/client.rs +++ b/azalea-client/src/client.rs @@ -182,55 +182,48 @@ impl Client { .await?; let (conn, game_profile) = loop { - let packet_result = conn.read().await; - match packet_result { - Ok(packet) => match packet { - ClientboundLoginPacket::Hello(p) => { - debug!("Got encryption request"); - let e = azalea_crypto::encrypt(&p.public_key, &p.nonce).unwrap(); + let packet = conn.read().await?; + match packet { + ClientboundLoginPacket::Hello(p) => { + debug!("Got encryption request"); + let e = azalea_crypto::encrypt(&p.public_key, &p.nonce).unwrap(); - if let Some(access_token) = &account.access_token { - conn.authenticate( - access_token, - &account - .uuid - .expect("Uuid must be present if access token is present."), - e.secret_key, - p, - ) - .await?; - } - - conn.write( - ServerboundKeyPacket { - nonce_or_salt_signature: NonceOrSaltSignature::Nonce( - e.encrypted_nonce, - ), - key_bytes: e.encrypted_public_key, - } - .get(), + if let Some(access_token) = &account.access_token { + conn.authenticate( + access_token, + &account + .uuid + .expect("Uuid must be present if access token is present."), + e.secret_key, + p, ) .await?; + } - conn.set_encryption_key(e.secret_key); - } - ClientboundLoginPacket::LoginCompression(p) => { - debug!("Got compression request {:?}", p.compression_threshold); - conn.set_compression_threshold(p.compression_threshold); - } - ClientboundLoginPacket::GameProfile(p) => { - debug!("Got profile {:?}", p.game_profile); - break (conn.game(), p.game_profile); - } - ClientboundLoginPacket::LoginDisconnect(p) => { - debug!("Got disconnect {:?}", p); - } - ClientboundLoginPacket::CustomQuery(p) => { - debug!("Got custom query {:?}", p); - } - }, - Err(e) => { - panic!("Error: {e:?}"); + conn.write( + ServerboundKeyPacket { + nonce_or_salt_signature: NonceOrSaltSignature::Nonce(e.encrypted_nonce), + key_bytes: e.encrypted_public_key, + } + .get(), + ) + .await?; + + conn.set_encryption_key(e.secret_key); + } + ClientboundLoginPacket::LoginCompression(p) => { + debug!("Got compression request {:?}", p.compression_threshold); + conn.set_compression_threshold(p.compression_threshold); + } + ClientboundLoginPacket::GameProfile(p) => { + debug!("Got profile {:?}", p.game_profile); + break (conn.game(), p.game_profile); + } + ClientboundLoginPacket::LoginDisconnect(p) => { + debug!("Got disconnect {:?}", p); + } + ClientboundLoginPacket::CustomQuery(p) => { + debug!("Got custom query {:?}", p); } } }; From 65d8fdcb6c13e8802a79fa2df570a57978b3c430 Mon Sep 17 00:00:00 2001 From: mat Date: Sat, 29 Oct 2022 14:02:57 -0500 Subject: [PATCH 02/18] oop fix another unwrap --- azalea-client/src/lib.rs | 2 +- azalea/src/lib.rs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/azalea-client/src/lib.rs b/azalea-client/src/lib.rs index 84af0298..265fbf8b 100755 --- a/azalea-client/src/lib.rs +++ b/azalea-client/src/lib.rs @@ -14,7 +14,7 @@ pub mod ping; mod player; pub use account::Account; -pub use client::{Client, ClientInformation, Event}; +pub use client::{Client, ClientInformation, Event, JoinError}; pub use movement::MoveDirection; pub use player::Player; diff --git a/azalea/src/lib.rs b/azalea/src/lib.rs index a7d0791a..2d0344fc 100644 --- a/azalea/src/lib.rs +++ b/azalea/src/lib.rs @@ -123,6 +123,8 @@ where pub enum Error { #[error("Invalid address")] InvalidAddress, + #[error("Join error: {0}")] + Join(#[from] azalea_client::JoinError), } /// Join a server and start handling events. This function will run forever until @@ -151,7 +153,7 @@ pub async fn start< Err(_) => return Err(Error::InvalidAddress), }; - let (bot, mut rx) = Client::join(&options.account, address).await.unwrap(); + let (bot, mut rx) = Client::join(&options.account, address).await?; let state = options.state; let bot_plugin = bot::Plugin::default(); From 7c71bdf79a851d9646fe60f00dd70429aa09263b Mon Sep 17 00:00:00 2001 From: mat Date: Sat, 29 Oct 2022 14:14:47 -0500 Subject: [PATCH 03/18] add doc comments to combat packets --- .../src/packets/game/clientbound_player_combat_end_packet.rs | 1 + .../src/packets/game/clientbound_player_combat_enter_packet.rs | 1 + .../src/packets/game/clientbound_player_combat_kill_packet.rs | 1 + 3 files changed, 3 insertions(+) diff --git a/azalea-protocol/src/packets/game/clientbound_player_combat_end_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_combat_end_packet.rs index 0276d379..67d29e93 100644 --- a/azalea-protocol/src/packets/game/clientbound_player_combat_end_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_player_combat_end_packet.rs @@ -1,6 +1,7 @@ use azalea_buf::McBuf; use azalea_protocol_macros::ClientboundGamePacket; +/// Unused in vanilla. #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] pub struct ClientboundPlayerCombatEndPacket { #[var] diff --git a/azalea-protocol/src/packets/game/clientbound_player_combat_enter_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_combat_enter_packet.rs index 8e7ef8a2..42ee1838 100644 --- a/azalea-protocol/src/packets/game/clientbound_player_combat_enter_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_player_combat_enter_packet.rs @@ -1,5 +1,6 @@ use azalea_buf::McBuf; use azalea_protocol_macros::ClientboundGamePacket; +/// Unused in vanilla. #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] pub struct ClientboundPlayerCombatEnterPacket {} diff --git a/azalea-protocol/src/packets/game/clientbound_player_combat_kill_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_combat_kill_packet.rs index 0492d16a..f1294f2e 100644 --- a/azalea-protocol/src/packets/game/clientbound_player_combat_kill_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_player_combat_kill_packet.rs @@ -2,6 +2,7 @@ use azalea_buf::McBuf; use azalea_chat::component::Component; use azalea_protocol_macros::ClientboundGamePacket; +/// Used to send a respawn screen. #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] pub struct ClientboundPlayerCombatKillPacket { #[var] From 7d140e5f0c70d45debc2fa3bc182e519607f3de8 Mon Sep 17 00:00:00 2001 From: mat Date: Sat, 29 Oct 2022 14:33:53 -0500 Subject: [PATCH 04/18] ClientboundContainerClosePacket --- azalea-auth/src/auth.rs | 10 ++-------- .../packets/game/clientbound_container_close_packet.rs | 7 +++++++ azalea-protocol/src/packets/game/mod.rs | 2 ++ 3 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 azalea-protocol/src/packets/game/clientbound_container_close_packet.rs diff --git a/azalea-auth/src/auth.rs b/azalea-auth/src/auth.rs index 0b043baf..b7f834d4 100644 --- a/azalea-auth/src/auth.rs +++ b/azalea-auth/src/auth.rs @@ -444,10 +444,7 @@ async fn check_ownership( ) -> Result { let res = client .get("https://api.minecraftservices.com/entitlements/mcstore") - .header( - "Authorization", - format!("Bearer {minecraft_access_token}"), - ) + .header("Authorization", format!("Bearer {minecraft_access_token}")) .send() .await? .json::() @@ -472,10 +469,7 @@ async fn get_profile( ) -> Result { let res = client .get("https://api.minecraftservices.com/minecraft/profile") - .header( - "Authorization", - format!("Bearer {minecraft_access_token}"), - ) + .header("Authorization", format!("Bearer {minecraft_access_token}")) .send() .await? .json::() diff --git a/azalea-protocol/src/packets/game/clientbound_container_close_packet.rs b/azalea-protocol/src/packets/game/clientbound_container_close_packet.rs new file mode 100644 index 00000000..a59da450 --- /dev/null +++ b/azalea-protocol/src/packets/game/clientbound_container_close_packet.rs @@ -0,0 +1,7 @@ +use azalea_buf::McBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] +pub struct ClientboundContainerClosePacket { + pub container_id: u8, +} diff --git a/azalea-protocol/src/packets/game/mod.rs b/azalea-protocol/src/packets/game/mod.rs index c23e426e..54247202 100644 --- a/azalea-protocol/src/packets/game/mod.rs +++ b/azalea-protocol/src/packets/game/mod.rs @@ -13,6 +13,7 @@ pub mod clientbound_change_difficulty_packet; pub mod clientbound_chat_preview_packet; pub mod clientbound_command_suggestions_packet; pub mod clientbound_commands_packet; +pub mod clientbound_container_close_packet; pub mod clientbound_container_set_content_packet; pub mod clientbound_container_set_data_packet; pub mod clientbound_container_set_slot_packet; @@ -229,6 +230,7 @@ declare_state_packets!( 0x0c: clientbound_chat_preview_packet::ClientboundChatPreviewPacket, 0x0e: clientbound_command_suggestions_packet::ClientboundCommandSuggestionsPacket, 0x0f: clientbound_commands_packet::ClientboundCommandsPacket, + 0x10: clientbound_container_close_packet::ClientboundContainerClosePacket, 0x11: clientbound_container_set_content_packet::ClientboundContainerSetContentPacket, 0x12: clientbound_container_set_data_packet::ClientboundContainerSetDataPacket, 0x13: clientbound_container_set_slot_packet::ClientboundContainerSetSlotPacket, From f73872c0ccdce0f442832114382839850506058d Mon Sep 17 00:00:00 2001 From: mat Date: Sat, 29 Oct 2022 14:36:07 -0500 Subject: [PATCH 05/18] add packet to match lol --- azalea-client/src/client.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs index 05461f0f..ab52b65e 100644 --- a/azalea-client/src/client.rs +++ b/azalea-client/src/client.rs @@ -751,6 +751,7 @@ impl Client { ClientboundGamePacket::TabList(_) => {} ClientboundGamePacket::TagQuery(_) => {} ClientboundGamePacket::TakeItemEntity(_) => {} + ClientboundGamePacket::ContainerClose(_) => {} } Ok(()) From 99d3a5de9d56bcb4f0367d8c8d6277ad14edd973 Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 30 Oct 2022 12:58:44 -0500 Subject: [PATCH 06/18] improve docs a little more --- azalea-client/src/account.rs | 8 +++++- azalea-client/src/get_mc_dir.rs | 43 +++++++++++++++++++++++++++------ azalea-protocol/src/connect.rs | 37 ++++++++++++++-------------- azalea-protocol/src/lib.rs | 3 +++ 4 files changed, 63 insertions(+), 28 deletions(-) diff --git a/azalea-client/src/account.rs b/azalea-client/src/account.rs index f63d342e..715f2fba 100644 --- a/azalea-client/src/account.rs +++ b/azalea-client/src/account.rs @@ -34,7 +34,13 @@ impl Account { /// a key for the cache, but it's recommended to use the real email to /// avoid confusion. pub async fn microsoft(email: &str) -> Result { - let minecraft_dir = get_mc_dir::minecraft_dir().unwrap(); + let minecraft_dir = get_mc_dir::minecraft_dir().expect( + format!( + "No {} environment variable found", + get_mc_dir::home_env_var() + ) + .as_str(), + ); let auth_result = azalea_auth::auth( email, azalea_auth::AuthOpts { diff --git a/azalea-client/src/get_mc_dir.rs b/azalea-client/src/get_mc_dir.rs index abc5b3c8..a8bddb1b 100644 --- a/azalea-client/src/get_mc_dir.rs +++ b/azalea-client/src/get_mc_dir.rs @@ -10,25 +10,52 @@ use std::path::PathBuf; /// Mac: `$HOME/Library/Application Support/minecraft`\ /// Linux: `$HOME/.minecraft` /// -/// Anywhere else it'll return None. +/// If the environment variable is not set, this will return `None`. pub fn minecraft_dir() -> Option { + let env_var = home_env_var(); + let home = std::env::var(env_var)?; + let path = PathBuf::from(home).join(minecraft_dir_relative()); + Some(path) +} + +/// Return the name of the environment variable that's used for the home folder +/// on the user's operating system. +pub fn home_env_var() -> &'static str { #[cfg(target_os = "windows")] { - let appdata = std::env::var("APPDATA").ok()?; - Some(PathBuf::from(appdata).join(".minecraft")) + "USERPROFILE" } #[cfg(target_os = "macos")] { - let home = std::env::var("HOME").ok()?; - Some(PathBuf::from(home).join("Library/Application Support/minecraft")) + "HOME" } #[cfg(target_os = "linux")] { - let home = std::env::var("HOME").ok()?; - Some(PathBuf::from(home).join(".minecraft")) + "HOME" } #[cfg(not(any(target_os = "windows", target_os = "macos", target_os = "linux")))] { - None + "HOME" + } +} + +/// Return the path relative to the home folder where we expect to find the +/// .minecraft directory. +pub fn minecraft_dir_relative() -> &'static str { + #[cfg(target_os = "windows")] + { + ".minecraft" + } + #[cfg(target_os = "macos")] + { + "Library/Application Support/minecraft" + } + #[cfg(target_os = "linux")] + { + ".minecraft" + } + #[cfg(not(any(target_os = "windows", target_os = "macos", target_os = "linux")))] + { + ".minecraft" } } diff --git a/azalea-protocol/src/connect.rs b/azalea-protocol/src/connect.rs index 06aedef9..c0c1a622 100644 --- a/azalea-protocol/src/connect.rs +++ b/azalea-protocol/src/connect.rs @@ -55,26 +55,24 @@ pub struct WriteConnection { /// hostname: address.host.to_string(), /// port: address.port, /// intention: ConnectionProtocol::Login, -/// } -/// .get(), -/// ) -/// .await?; -/// let mut conn = conn.login(); +/// }.get()); /// -/// // login -/// conn.write( -/// ServerboundHelloPacket { -/// username, -/// public_key: None, -/// profile_id: None, -/// } -/// .get(), -/// ) -/// .await?; +/// .await?; +/// let mut conn = conn.login(); /// -/// let (conn, game_profile) = loop { -/// let packet_result = conn.read().await; -/// match packet_result { +/// // login +/// conn.write( +/// ServerboundHelloPacket { +/// username, +/// public_key: None, +/// profile_id: None, +/// } +/// .get(), +/// ) +/// .await?; +/// +/// let (conn, game_profile) = loop { +/// let packet_result = conn.read().await?; /// Ok(packet) => match packet { /// ClientboundLoginPacket::Hello(p) => { /// let e = azalea_crypto::encrypt(&p.public_key, &p.nonce).unwrap(); @@ -87,7 +85,8 @@ pub struct WriteConnection { /// .get(), /// ) /// .await?; -/// conn.set_encryption_key(e.secret_key); } +/// conn.set_encryption_key(e.secret_key); +/// } /// ClientboundLoginPacket::LoginCompression(p) => { /// conn.set_compression_threshold(p.compression_threshold); /// } diff --git a/azalea-protocol/src/lib.rs b/azalea-protocol/src/lib.rs index ab447210..84306142 100755 --- a/azalea-protocol/src/lib.rs +++ b/azalea-protocol/src/lib.rs @@ -3,6 +3,9 @@ //! You should probably use [`azalea`] or [`azalea_client`] instead, as //! azalea_protocol delegates much of the work, such as auth, to the user of //! the crate. +//! +//! [`azalea`]: https://crates.io/crates/azalea +//! [`azalea_client`]: https://crates.io/crates/azalea-client // these two are necessary for thiserror backtraces #![feature(error_generic_member_access)] From f0e9a4822258197b02025ca17e0d2a71b64a6db6 Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 30 Oct 2022 13:07:14 -0500 Subject: [PATCH 07/18] fix error --- azalea-client/src/get_mc_dir.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azalea-client/src/get_mc_dir.rs b/azalea-client/src/get_mc_dir.rs index a8bddb1b..440550a7 100644 --- a/azalea-client/src/get_mc_dir.rs +++ b/azalea-client/src/get_mc_dir.rs @@ -13,7 +13,7 @@ use std::path::PathBuf; /// If the environment variable is not set, this will return `None`. pub fn minecraft_dir() -> Option { let env_var = home_env_var(); - let home = std::env::var(env_var)?; + let home = std::env::var(env_var).ok()?; let path = PathBuf::from(home).join(minecraft_dir_relative()); Some(path) } From 889f7426961eaa56bd4507aa5bd28cd9b26fd2ed Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 30 Oct 2022 14:03:13 -0500 Subject: [PATCH 08/18] add "repository" field to all crates --- azalea-auth/Cargo.toml | 15 ++++++++------- azalea-block/Cargo.toml | 5 +++-- azalea-block/azalea-block-macros/Cargo.toml | 1 + azalea-brigadier/Cargo.toml | 1 + azalea-buf/Cargo.toml | 3 ++- azalea-buf/azalea-buf-macros/Cargo.toml | 1 + azalea-chat/Cargo.toml | 1 + azalea-client/Cargo.toml | 1 + azalea-core/Cargo.toml | 1 + azalea-crypto/Cargo.toml | 1 + azalea-language/Cargo.toml | 1 + azalea-nbt/Cargo.toml | 1 + azalea-physics/Cargo.toml | 1 + azalea-protocol/Cargo.toml | 1 + azalea-protocol/azalea-protocol-macros/Cargo.toml | 1 + azalea-registry/Cargo.toml | 1 + azalea-registry/azalea-registry-macros/Cargo.toml | 1 + azalea-world/Cargo.toml | 13 +++++++------ azalea/Cargo.toml | 5 +++-- 19 files changed, 37 insertions(+), 18 deletions(-) diff --git a/azalea-auth/Cargo.toml b/azalea-auth/Cargo.toml index 4e26e6e4..4199ad3c 100644 --- a/azalea-auth/Cargo.toml +++ b/azalea-auth/Cargo.toml @@ -3,23 +3,24 @@ description = "A port of Mojang's Authlib and launcher authentication." edition = "2021" license = "MIT" name = "azalea-auth" +repository = "https://github.com/mat-1/azalea/tree/main/azalea-auth" version = "0.2.2" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -azalea-buf = { path = "../azalea-buf", version = "^0.2.0" } -azalea-crypto = { path = "../azalea-crypto", version = "^0.2.0" } -chrono = { version = "0.4.22", default-features = false } +azalea-buf = {path = "../azalea-buf", version = "^0.2.0"} +azalea-crypto = {path = "../azalea-crypto", version = "^0.2.0"} +chrono = {version = "0.4.22", default-features = false} log = "0.4.17" num-bigint = "0.4.3" -reqwest = { version = "0.11.12", features = ["json"] } -serde = { version = "1.0.145", features = ["derive"] } +reqwest = {version = "0.11.12", features = ["json"]} +serde = {version = "1.0.145", features = ["derive"]} serde_json = "1.0.86" thiserror = "1.0.37" -tokio = { version = "1.21.2", features = ["fs"] } +tokio = {version = "1.21.2", features = ["fs"]} uuid = "^1.1.2" [dev-dependencies] env_logger = "0.9.1" -tokio = { version = "1.21.2", features = ["full"] } +tokio = {version = "1.21.2", features = ["full"]} diff --git a/azalea-block/Cargo.toml b/azalea-block/Cargo.toml index f964713e..26d30ec8 100644 --- a/azalea-block/Cargo.toml +++ b/azalea-block/Cargo.toml @@ -3,6 +3,7 @@ description = "Representation of Minecraft block states." edition = "2021" license = "MIT" name = "azalea-block" +repository = "https://github.com/mat-1/azalea/tree/main/azalea-block" version = "0.2.0" [lib] @@ -10,5 +11,5 @@ version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -azalea-block-macros = {path = "./azalea-block-macros", version = "^0.2.0" } -azalea-buf = {path = "../azalea-buf", version = "^0.2.0" } +azalea-block-macros = {path = "./azalea-block-macros", version = "^0.2.0"} +azalea-buf = {path = "../azalea-buf", version = "^0.2.0"} diff --git a/azalea-block/azalea-block-macros/Cargo.toml b/azalea-block/azalea-block-macros/Cargo.toml index d208dc99..c1e66f62 100644 --- a/azalea-block/azalea-block-macros/Cargo.toml +++ b/azalea-block/azalea-block-macros/Cargo.toml @@ -3,6 +3,7 @@ description = "Proc macros used by azalea-block." edition = "2021" license = "MIT" name = "azalea-block-macros" +repository = "https://github.com/mat-1/azalea/tree/main/azalea-block/azalea-block-macros" version = "0.2.0" [lib] diff --git a/azalea-brigadier/Cargo.toml b/azalea-brigadier/Cargo.toml index f078cbef..c959b0f5 100644 --- a/azalea-brigadier/Cargo.toml +++ b/azalea-brigadier/Cargo.toml @@ -3,6 +3,7 @@ description = "A port of Mojang's Brigadier command parsing and dispatching libr edition = "2021" license = "MIT" name = "azalea-brigadier" +repository = "https://github.com/mat-1/azalea/tree/main/azalea-brigadier" version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/azalea-buf/Cargo.toml b/azalea-buf/Cargo.toml index 71b0eb83..7011610e 100644 --- a/azalea-buf/Cargo.toml +++ b/azalea-buf/Cargo.toml @@ -3,12 +3,13 @@ description = "Serialize and deserialize buffers from Minecraft." edition = "2021" license = "MIT" name = "azalea-buf" +repository = "https://github.com/mat-1/azalea/tree/main/azalea-buf" version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -azalea-buf-macros = {path = "./azalea-buf-macros", version = "^0.2.0" } +azalea-buf-macros = {path = "./azalea-buf-macros", version = "^0.2.0"} byteorder = "^1.4.3" serde_json = {version = "^1.0", optional = true} thiserror = "^1.0.34" diff --git a/azalea-buf/azalea-buf-macros/Cargo.toml b/azalea-buf/azalea-buf-macros/Cargo.toml index 1ca72c57..26ed3329 100644 --- a/azalea-buf/azalea-buf-macros/Cargo.toml +++ b/azalea-buf/azalea-buf-macros/Cargo.toml @@ -3,6 +3,7 @@ description = "#[derive(McBuf)]" edition = "2021" license = "MIT" name = "azalea-buf-macros" +repository = "https://github.com/mat-1/azalea/tree/main/azalea-buf" version = "0.2.0" [lib] diff --git a/azalea-chat/Cargo.toml b/azalea-chat/Cargo.toml index 8fd77e96..60460053 100644 --- a/azalea-chat/Cargo.toml +++ b/azalea-chat/Cargo.toml @@ -4,6 +4,7 @@ edition = "2021" license = "MIT" name = "azalea-chat" version = "0.2.0" +repository = "https://github.com/mat-1/azalea/tree/main/azalea-chat" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/azalea-client/Cargo.toml b/azalea-client/Cargo.toml index 84df872a..910d1376 100644 --- a/azalea-client/Cargo.toml +++ b/azalea-client/Cargo.toml @@ -4,6 +4,7 @@ edition = "2021" license = "MIT" name = "azalea-client" version = "0.2.2" +repository = "https://github.com/mat-1/azalea/tree/main/azalea-client" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/azalea-core/Cargo.toml b/azalea-core/Cargo.toml index dec1e61e..775b481a 100644 --- a/azalea-core/Cargo.toml +++ b/azalea-core/Cargo.toml @@ -4,6 +4,7 @@ edition = "2021" license = "MIT" name = "azalea-core" version = "0.2.0" +repository = "https://github.com/mat-1/azalea/tree/main/azalea-core" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/azalea-crypto/Cargo.toml b/azalea-crypto/Cargo.toml index 50ea7358..68930c23 100644 --- a/azalea-crypto/Cargo.toml +++ b/azalea-crypto/Cargo.toml @@ -4,6 +4,7 @@ edition = "2021" license = "MIT" name = "azalea-crypto" version = "0.2.0" +repository = "https://github.com/mat-1/azalea/tree/main/azalea-crypto" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/azalea-language/Cargo.toml b/azalea-language/Cargo.toml index f1902c05..bbb0e87b 100644 --- a/azalea-language/Cargo.toml +++ b/azalea-language/Cargo.toml @@ -4,6 +4,7 @@ edition = "2021" license = "MIT" name = "azalea-language" version = "0.2.0" +repository = "https://github.com/mat-1/azalea/tree/main/azalea-language" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/azalea-nbt/Cargo.toml b/azalea-nbt/Cargo.toml index 5ad2b943..89e14072 100644 --- a/azalea-nbt/Cargo.toml +++ b/azalea-nbt/Cargo.toml @@ -4,6 +4,7 @@ edition = "2021" license = "MIT" name = "azalea-nbt" version = "0.2.0" +repository = "https://github.com/mat-1/azalea/tree/main/azalea-nbt" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/azalea-physics/Cargo.toml b/azalea-physics/Cargo.toml index d40fe3e7..fdaf7889 100644 --- a/azalea-physics/Cargo.toml +++ b/azalea-physics/Cargo.toml @@ -4,6 +4,7 @@ edition = "2021" license = "MIT" name = "azalea-physics" version = "0.2.0" +repository = "https://github.com/mat-1/azalea/tree/main/azalea-physics" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/azalea-protocol/Cargo.toml b/azalea-protocol/Cargo.toml index 009c1344..0f4d5d36 100644 --- a/azalea-protocol/Cargo.toml +++ b/azalea-protocol/Cargo.toml @@ -4,6 +4,7 @@ edition = "2021" license = "MIT" name = "azalea-protocol" version = "0.2.0" +repository = "https://github.com/mat-1/azalea/tree/main/azalea-protocol" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/azalea-protocol/azalea-protocol-macros/Cargo.toml b/azalea-protocol/azalea-protocol-macros/Cargo.toml index 7b1e200f..9a70b820 100644 --- a/azalea-protocol/azalea-protocol-macros/Cargo.toml +++ b/azalea-protocol/azalea-protocol-macros/Cargo.toml @@ -4,6 +4,7 @@ edition = "2021" license = "MIT" name = "azalea-protocol-macros" version = "0.2.0" +repository = "https://github.com/mat-1/azalea/tree/main/azalea-protocol/azalea-protocol-macros" [lib] proc-macro = true diff --git a/azalea-registry/Cargo.toml b/azalea-registry/Cargo.toml index 82be0bb2..52bbd453 100644 --- a/azalea-registry/Cargo.toml +++ b/azalea-registry/Cargo.toml @@ -4,6 +4,7 @@ edition = "2021" license = "MIT" name = "azalea-registry" version = "0.2.0" +repository = "https://github.com/mat-1/azalea/tree/main/azalea-registry" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/azalea-registry/azalea-registry-macros/Cargo.toml b/azalea-registry/azalea-registry-macros/Cargo.toml index a068158f..6ba5da92 100644 --- a/azalea-registry/azalea-registry-macros/Cargo.toml +++ b/azalea-registry/azalea-registry-macros/Cargo.toml @@ -3,6 +3,7 @@ description = "Macros internally used in azalea-registry." edition = "2021" license = "MIT" name = "azalea-registry-macros" +repository = "https://github.com/mat-1/azalea/tree/main/azalea-registry/azalea-registry-macros" version = "0.2.0" [lib] diff --git a/azalea-world/Cargo.toml b/azalea-world/Cargo.toml index fd42e621..c052f89f 100644 --- a/azalea-world/Cargo.toml +++ b/azalea-world/Cargo.toml @@ -3,17 +3,18 @@ description = "The Minecraft world representation used in Azalea." edition = "2021" license = "MIT" name = "azalea-world" +repository = "https://github.com/mat-1/azalea/tree/main/azalea-world" version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -azalea-block = {path = "../azalea-block", default-features = false, version = "^0.2.0" } -azalea-buf = {path = "../azalea-buf", version = "^0.2.0" } -azalea-chat = {path = "../azalea-chat", version = "^0.2.0" } -azalea-core = {path = "../azalea-core", version = "^0.2.0" } -azalea-nbt = {path = "../azalea-nbt", version = "^0.2.0" } -azalea-registry = {path = "../azalea-registry", version = "^0.2.0" } +azalea-block = {path = "../azalea-block", default-features = false, version = "^0.2.0"} +azalea-buf = {path = "../azalea-buf", version = "^0.2.0"} +azalea-chat = {path = "../azalea-chat", version = "^0.2.0"} +azalea-core = {path = "../azalea-core", version = "^0.2.0"} +azalea-nbt = {path = "../azalea-nbt", version = "^0.2.0"} +azalea-registry = {path = "../azalea-registry", version = "^0.2.0"} log = "0.4.17" nohash-hasher = "0.2.0" thiserror = "1.0.34" diff --git a/azalea/Cargo.toml b/azalea/Cargo.toml index e86dbde4..a456d1ea 100644 --- a/azalea/Cargo.toml +++ b/azalea/Cargo.toml @@ -3,6 +3,7 @@ description = "A framework for creating Minecraft bots." edition = "2021" license = "MIT" name = "azalea" +repository = "https://github.com/mat-1/azalea/tree/main/azalea" version = "0.2.4" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -10,8 +11,8 @@ version = "0.2.4" [dependencies] anyhow = "^1.0.65" async-trait = "^0.1.57" -azalea-client = { version = "0.2.2", path = "../azalea-client" } -azalea-protocol = { version = "0.2.0", path = "../azalea-protocol" } +azalea-client = {version = "0.2.2", path = "../azalea-client"} +azalea-protocol = {version = "0.2.0", path = "../azalea-protocol"} parking_lot = "^0.12.1" thiserror = "^1.0.37" tokio = "^1.21.1" From 44ab1ad6ef52f31399fb0deabe71ec5e43cc9a08 Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 30 Oct 2022 14:04:11 -0500 Subject: [PATCH 09/18] chore: Release --- Cargo.lock | 38 +++++++++---------- azalea-auth/Cargo.toml | 6 +-- azalea-block/Cargo.toml | 6 +-- azalea-block/azalea-block-macros/Cargo.toml | 2 +- azalea-brigadier/Cargo.toml | 2 +- azalea-buf/Cargo.toml | 4 +- azalea-buf/azalea-buf-macros/Cargo.toml | 2 +- azalea-chat/Cargo.toml | 6 +-- azalea-client/Cargo.toml | 18 ++++----- azalea-core/Cargo.toml | 8 ++-- azalea-crypto/Cargo.toml | 4 +- azalea-language/Cargo.toml | 2 +- azalea-nbt/Cargo.toml | 4 +- azalea-physics/Cargo.toml | 8 ++-- azalea-protocol/Cargo.toml | 24 ++++++------ .../azalea-protocol-macros/Cargo.toml | 2 +- azalea-registry/Cargo.toml | 6 +-- .../azalea-registry-macros/Cargo.toml | 2 +- azalea-world/Cargo.toml | 14 +++---- azalea/Cargo.toml | 6 +-- 20 files changed, 82 insertions(+), 82 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9f537122..2837c689 100755 --- a/Cargo.lock +++ b/Cargo.lock @@ -100,7 +100,7 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "azalea" -version = "0.2.4" +version = "0.3.0" dependencies = [ "anyhow", "async-trait", @@ -114,7 +114,7 @@ dependencies = [ [[package]] name = "azalea-auth" -version = "0.2.2" +version = "0.3.0" dependencies = [ "azalea-buf", "azalea-crypto", @@ -132,7 +132,7 @@ dependencies = [ [[package]] name = "azalea-block" -version = "0.2.0" +version = "0.3.0" dependencies = [ "azalea-block-macros", "azalea-buf", @@ -140,7 +140,7 @@ dependencies = [ [[package]] name = "azalea-block-macros" -version = "0.2.0" +version = "0.3.0" dependencies = [ "proc-macro2", "quote", @@ -149,11 +149,11 @@ dependencies = [ [[package]] name = "azalea-brigadier" -version = "0.2.0" +version = "0.3.0" [[package]] name = "azalea-buf" -version = "0.2.0" +version = "0.3.0" dependencies = [ "azalea-buf-macros", "byteorder", @@ -165,7 +165,7 @@ dependencies = [ [[package]] name = "azalea-buf-macros" -version = "0.2.0" +version = "0.3.0" dependencies = [ "proc-macro2", "quote", @@ -174,7 +174,7 @@ dependencies = [ [[package]] name = "azalea-chat" -version = "0.2.0" +version = "0.3.0" dependencies = [ "azalea-buf", "azalea-language", @@ -185,7 +185,7 @@ dependencies = [ [[package]] name = "azalea-client" -version = "0.2.2" +version = "0.3.0" dependencies = [ "anyhow", "azalea-auth", @@ -205,7 +205,7 @@ dependencies = [ [[package]] name = "azalea-core" -version = "0.2.0" +version = "0.3.0" dependencies = [ "azalea-buf", "azalea-chat", @@ -215,7 +215,7 @@ dependencies = [ [[package]] name = "azalea-crypto" -version = "0.2.0" +version = "0.3.0" dependencies = [ "aes", "azalea-buf", @@ -230,7 +230,7 @@ dependencies = [ [[package]] name = "azalea-language" -version = "0.2.0" +version = "0.3.0" dependencies = [ "lazy_static", "serde", @@ -239,7 +239,7 @@ dependencies = [ [[package]] name = "azalea-nbt" -version = "0.2.0" +version = "0.3.0" dependencies = [ "ahash", "azalea-buf", @@ -252,7 +252,7 @@ dependencies = [ [[package]] name = "azalea-physics" -version = "0.2.0" +version = "0.3.0" dependencies = [ "azalea-block", "azalea-core", @@ -263,7 +263,7 @@ dependencies = [ [[package]] name = "azalea-protocol" -version = "0.2.0" +version = "0.3.0" dependencies = [ "async-compression", "async-recursion", @@ -295,7 +295,7 @@ dependencies = [ [[package]] name = "azalea-protocol-macros" -version = "0.2.0" +version = "0.3.0" dependencies = [ "proc-macro2", "quote", @@ -304,7 +304,7 @@ dependencies = [ [[package]] name = "azalea-registry" -version = "0.2.0" +version = "0.3.0" dependencies = [ "azalea-buf", "azalea-registry-macros", @@ -312,7 +312,7 @@ dependencies = [ [[package]] name = "azalea-registry-macros" -version = "0.2.0" +version = "0.3.0" dependencies = [ "proc-macro2", "quote", @@ -321,7 +321,7 @@ dependencies = [ [[package]] name = "azalea-world" -version = "0.2.0" +version = "0.3.0" dependencies = [ "azalea-block", "azalea-buf", diff --git a/azalea-auth/Cargo.toml b/azalea-auth/Cargo.toml index 4199ad3c..da5460ab 100644 --- a/azalea-auth/Cargo.toml +++ b/azalea-auth/Cargo.toml @@ -4,13 +4,13 @@ edition = "2021" license = "MIT" name = "azalea-auth" repository = "https://github.com/mat-1/azalea/tree/main/azalea-auth" -version = "0.2.2" +version = "0.3.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -azalea-buf = {path = "../azalea-buf", version = "^0.2.0"} -azalea-crypto = {path = "../azalea-crypto", version = "^0.2.0"} +azalea-buf = {path = "../azalea-buf", version = "^0.3.0" } +azalea-crypto = {path = "../azalea-crypto", version = "^0.3.0" } chrono = {version = "0.4.22", default-features = false} log = "0.4.17" num-bigint = "0.4.3" diff --git a/azalea-block/Cargo.toml b/azalea-block/Cargo.toml index 26d30ec8..18faf275 100644 --- a/azalea-block/Cargo.toml +++ b/azalea-block/Cargo.toml @@ -4,12 +4,12 @@ edition = "2021" license = "MIT" name = "azalea-block" repository = "https://github.com/mat-1/azalea/tree/main/azalea-block" -version = "0.2.0" +version = "0.3.0" [lib] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -azalea-block-macros = {path = "./azalea-block-macros", version = "^0.2.0"} -azalea-buf = {path = "../azalea-buf", version = "^0.2.0"} +azalea-block-macros = {path = "./azalea-block-macros", version = "^0.3.0" } +azalea-buf = {path = "../azalea-buf", version = "^0.3.0" } diff --git a/azalea-block/azalea-block-macros/Cargo.toml b/azalea-block/azalea-block-macros/Cargo.toml index c1e66f62..dc8b1f27 100644 --- a/azalea-block/azalea-block-macros/Cargo.toml +++ b/azalea-block/azalea-block-macros/Cargo.toml @@ -4,7 +4,7 @@ edition = "2021" license = "MIT" name = "azalea-block-macros" repository = "https://github.com/mat-1/azalea/tree/main/azalea-block/azalea-block-macros" -version = "0.2.0" +version = "0.3.0" [lib] proc-macro = true diff --git a/azalea-brigadier/Cargo.toml b/azalea-brigadier/Cargo.toml index c959b0f5..987f1867 100644 --- a/azalea-brigadier/Cargo.toml +++ b/azalea-brigadier/Cargo.toml @@ -4,7 +4,7 @@ edition = "2021" license = "MIT" name = "azalea-brigadier" repository = "https://github.com/mat-1/azalea/tree/main/azalea-brigadier" -version = "0.2.0" +version = "0.3.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/azalea-buf/Cargo.toml b/azalea-buf/Cargo.toml index 7011610e..d8be1a11 100644 --- a/azalea-buf/Cargo.toml +++ b/azalea-buf/Cargo.toml @@ -4,12 +4,12 @@ edition = "2021" license = "MIT" name = "azalea-buf" repository = "https://github.com/mat-1/azalea/tree/main/azalea-buf" -version = "0.2.0" +version = "0.3.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -azalea-buf-macros = {path = "./azalea-buf-macros", version = "^0.2.0"} +azalea-buf-macros = {path = "./azalea-buf-macros", version = "^0.3.0" } byteorder = "^1.4.3" serde_json = {version = "^1.0", optional = true} thiserror = "^1.0.34" diff --git a/azalea-buf/azalea-buf-macros/Cargo.toml b/azalea-buf/azalea-buf-macros/Cargo.toml index 26ed3329..155acc84 100644 --- a/azalea-buf/azalea-buf-macros/Cargo.toml +++ b/azalea-buf/azalea-buf-macros/Cargo.toml @@ -4,7 +4,7 @@ edition = "2021" license = "MIT" name = "azalea-buf-macros" repository = "https://github.com/mat-1/azalea/tree/main/azalea-buf" -version = "0.2.0" +version = "0.3.0" [lib] proc-macro = true diff --git a/azalea-chat/Cargo.toml b/azalea-chat/Cargo.toml index 60460053..7710a4c2 100644 --- a/azalea-chat/Cargo.toml +++ b/azalea-chat/Cargo.toml @@ -3,14 +3,14 @@ description = "Parse Minecraft chat messages." edition = "2021" license = "MIT" name = "azalea-chat" -version = "0.2.0" +version = "0.3.0" repository = "https://github.com/mat-1/azalea/tree/main/azalea-chat" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -azalea-buf = {path = "../azalea-buf", features = ["serde_json"], version = "^0.2.0" } -azalea-language = {path = "../azalea-language", version = "^0.2.0" } +azalea-buf = {path = "../azalea-buf", features = ["serde_json"], version = "^0.3.0" } +azalea-language = {path = "../azalea-language", version = "^0.3.0" } lazy_static = "^1.4.0" serde = "^1.0.130" serde_json = "^1.0.72" diff --git a/azalea-client/Cargo.toml b/azalea-client/Cargo.toml index 910d1376..93559293 100644 --- a/azalea-client/Cargo.toml +++ b/azalea-client/Cargo.toml @@ -3,21 +3,21 @@ description = "A headless Minecraft client." edition = "2021" license = "MIT" name = "azalea-client" -version = "0.2.2" +version = "0.3.0" repository = "https://github.com/mat-1/azalea/tree/main/azalea-client" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] anyhow = "1.0.59" -azalea-auth = { path = "../azalea-auth", version = "0.2.1" } -azalea-block = { path = "../azalea-block", version = "0.2.0" } -azalea-chat = { path = "../azalea-chat", version = "0.2.0" } -azalea-core = { path = "../azalea-core", version = "0.2.0" } -azalea-crypto = { path = "../azalea-crypto", version = "0.2.0" } -azalea-physics = { path = "../azalea-physics", version = "0.2.0" } -azalea-protocol = { path = "../azalea-protocol", version = "0.2.0" } -azalea-world = { path = "../azalea-world", version = "0.2.0" } +azalea-auth = { path = "../azalea-auth", version = "0.3.0" } +azalea-block = { path = "../azalea-block", version = "0.3.0" } +azalea-chat = { path = "../azalea-chat", version = "0.3.0" } +azalea-core = { path = "../azalea-core", version = "0.3.0" } +azalea-crypto = { path = "../azalea-crypto", version = "0.3.0" } +azalea-physics = { path = "../azalea-physics", version = "0.3.0" } +azalea-protocol = { path = "../azalea-protocol", version = "0.3.0" } +azalea-world = { path = "../azalea-world", version = "0.3.0" } log = "0.4.17" parking_lot = "0.12.1" thiserror = "^1.0.34" diff --git a/azalea-core/Cargo.toml b/azalea-core/Cargo.toml index 775b481a..6d0174ba 100644 --- a/azalea-core/Cargo.toml +++ b/azalea-core/Cargo.toml @@ -3,13 +3,13 @@ description = "Miscellaneous things in Azalea." edition = "2021" license = "MIT" name = "azalea-core" -version = "0.2.0" +version = "0.3.0" repository = "https://github.com/mat-1/azalea/tree/main/azalea-core" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -azalea-buf = {path = "../azalea-buf", version = "^0.2.0" } -azalea-chat = {path = "../azalea-chat", version = "^0.2.0" } -azalea-nbt = {path = "../azalea-nbt", version = "^0.2.0" } +azalea-buf = {path = "../azalea-buf", version = "^0.3.0" } +azalea-chat = {path = "../azalea-chat", version = "^0.3.0" } +azalea-nbt = {path = "../azalea-nbt", version = "^0.3.0" } uuid = "^1.1.2" diff --git a/azalea-crypto/Cargo.toml b/azalea-crypto/Cargo.toml index 68930c23..82057ec2 100644 --- a/azalea-crypto/Cargo.toml +++ b/azalea-crypto/Cargo.toml @@ -3,14 +3,14 @@ description = "Cryptography features used in Minecraft." edition = "2021" license = "MIT" name = "azalea-crypto" -version = "0.2.0" +version = "0.3.0" repository = "https://github.com/mat-1/azalea/tree/main/azalea-crypto" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] aes = "0.8.1" -azalea-buf = {path = "../azalea-buf", version = "^0.2.0" } +azalea-buf = {path = "../azalea-buf", version = "^0.3.0" } cfb8 = "0.8.1" num-bigint = "^0.4.3" rand = {version = "^0.8.4", features = ["getrandom"]} diff --git a/azalea-language/Cargo.toml b/azalea-language/Cargo.toml index bbb0e87b..4793092a 100644 --- a/azalea-language/Cargo.toml +++ b/azalea-language/Cargo.toml @@ -3,7 +3,7 @@ description = "Translate Minecraft strings from their id." edition = "2021" license = "MIT" name = "azalea-language" -version = "0.2.0" +version = "0.3.0" repository = "https://github.com/mat-1/azalea/tree/main/azalea-language" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/azalea-nbt/Cargo.toml b/azalea-nbt/Cargo.toml index 89e14072..5e776dbe 100644 --- a/azalea-nbt/Cargo.toml +++ b/azalea-nbt/Cargo.toml @@ -3,14 +3,14 @@ description = "A fast NBT serializer and deserializer." edition = "2021" license = "MIT" name = "azalea-nbt" -version = "0.2.0" +version = "0.3.0" repository = "https://github.com/mat-1/azalea/tree/main/azalea-nbt" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] ahash = "^0.8.0" -azalea-buf = {path = "../azalea-buf", version = "^0.2.0" } +azalea-buf = {path = "../azalea-buf", version = "^0.3.0" } byteorder = "^1.4.3" flate2 = "^1.0.23" num-derive = "^0.3.3" diff --git a/azalea-physics/Cargo.toml b/azalea-physics/Cargo.toml index fdaf7889..8012a674 100644 --- a/azalea-physics/Cargo.toml +++ b/azalea-physics/Cargo.toml @@ -3,15 +3,15 @@ description = "Physics for Minecraft entities." edition = "2021" license = "MIT" name = "azalea-physics" -version = "0.2.0" +version = "0.3.0" repository = "https://github.com/mat-1/azalea/tree/main/azalea-physics" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -azalea-block = { path = "../azalea-block", version = "^0.2.0" } -azalea-core = { path = "../azalea-core", version = "^0.2.0" } -azalea-world = { path = "../azalea-world", version = "^0.2.0" } +azalea-block = { path = "../azalea-block", version = "^0.3.0" } +azalea-core = { path = "../azalea-core", version = "^0.3.0" } +azalea-world = { path = "../azalea-world", version = "^0.3.0" } lazy_static = "1.4.0" [dev-dependencies] diff --git a/azalea-protocol/Cargo.toml b/azalea-protocol/Cargo.toml index 0f4d5d36..f08282d0 100644 --- a/azalea-protocol/Cargo.toml +++ b/azalea-protocol/Cargo.toml @@ -3,7 +3,7 @@ description = "Send and receive Minecraft packets." edition = "2021" license = "MIT" name = "azalea-protocol" -version = "0.2.0" +version = "0.3.0" repository = "https://github.com/mat-1/azalea/tree/main/azalea-protocol" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -11,17 +11,17 @@ repository = "https://github.com/mat-1/azalea/tree/main/azalea-protocol" [dependencies] async-compression = {version = "^0.3.8", features = ["tokio", "zlib"], optional = true} async-recursion = "1.0.0" -azalea-auth = {path = "../azalea-auth", version = "^0.2.1" } -azalea-block = {path = "../azalea-block", default-features = false, version = "^0.2.0" } -azalea-brigadier = {path = "../azalea-brigadier", version = "^0.2.0" } -azalea-buf = {path = "../azalea-buf", version = "^0.2.0" } -azalea-chat = {path = "../azalea-chat", version = "^0.2.0" } -azalea-core = {path = "../azalea-core", optional = true, version = "^0.2.0" } -azalea-crypto = {path = "../azalea-crypto", version = "^0.2.0" } -azalea-nbt = {path = "../azalea-nbt", version = "^0.2.0" } -azalea-protocol-macros = {path = "./azalea-protocol-macros", version = "^0.2.0" } -azalea-registry = {path = "../azalea-registry", version = "^0.2.0" } -azalea-world = {path = "../azalea-world", version = "^0.2.0" } +azalea-auth = {path = "../azalea-auth", version = "^0.3.0" } +azalea-block = {path = "../azalea-block", default-features = false, version = "^0.3.0" } +azalea-brigadier = {path = "../azalea-brigadier", version = "^0.3.0" } +azalea-buf = {path = "../azalea-buf", version = "^0.3.0" } +azalea-chat = {path = "../azalea-chat", version = "^0.3.0" } +azalea-core = {path = "../azalea-core", optional = true, version = "^0.3.0" } +azalea-crypto = {path = "../azalea-crypto", version = "^0.3.0" } +azalea-nbt = {path = "../azalea-nbt", version = "^0.3.0" } +azalea-protocol-macros = {path = "./azalea-protocol-macros", version = "^0.3.0" } +azalea-registry = {path = "../azalea-registry", version = "^0.3.0" } +azalea-world = {path = "../azalea-world", version = "^0.3.0" } byteorder = "^1.4.3" bytes = "^1.1.0" flate2 = "1.0.23" diff --git a/azalea-protocol/azalea-protocol-macros/Cargo.toml b/azalea-protocol/azalea-protocol-macros/Cargo.toml index 9a70b820..b3a16b16 100644 --- a/azalea-protocol/azalea-protocol-macros/Cargo.toml +++ b/azalea-protocol/azalea-protocol-macros/Cargo.toml @@ -3,7 +3,7 @@ description = "Macros internally used in azalea-protocol." edition = "2021" license = "MIT" name = "azalea-protocol-macros" -version = "0.2.0" +version = "0.3.0" repository = "https://github.com/mat-1/azalea/tree/main/azalea-protocol/azalea-protocol-macros" [lib] diff --git a/azalea-registry/Cargo.toml b/azalea-registry/Cargo.toml index 52bbd453..6c742c0a 100644 --- a/azalea-registry/Cargo.toml +++ b/azalea-registry/Cargo.toml @@ -3,11 +3,11 @@ description = "Use Minecraft's registries." edition = "2021" license = "MIT" name = "azalea-registry" -version = "0.2.0" +version = "0.3.0" repository = "https://github.com/mat-1/azalea/tree/main/azalea-registry" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -azalea-buf = {path = "../azalea-buf", version = "^0.2.0" } -azalea-registry-macros = {path = "./azalea-registry-macros", version = "^0.2.0" } +azalea-buf = {path = "../azalea-buf", version = "^0.3.0" } +azalea-registry-macros = {path = "./azalea-registry-macros", version = "^0.3.0" } diff --git a/azalea-registry/azalea-registry-macros/Cargo.toml b/azalea-registry/azalea-registry-macros/Cargo.toml index 6ba5da92..353183f0 100644 --- a/azalea-registry/azalea-registry-macros/Cargo.toml +++ b/azalea-registry/azalea-registry-macros/Cargo.toml @@ -4,7 +4,7 @@ edition = "2021" license = "MIT" name = "azalea-registry-macros" repository = "https://github.com/mat-1/azalea/tree/main/azalea-registry/azalea-registry-macros" -version = "0.2.0" +version = "0.3.0" [lib] proc-macro = true diff --git a/azalea-world/Cargo.toml b/azalea-world/Cargo.toml index c052f89f..058feca1 100644 --- a/azalea-world/Cargo.toml +++ b/azalea-world/Cargo.toml @@ -4,17 +4,17 @@ edition = "2021" license = "MIT" name = "azalea-world" repository = "https://github.com/mat-1/azalea/tree/main/azalea-world" -version = "0.2.0" +version = "0.3.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -azalea-block = {path = "../azalea-block", default-features = false, version = "^0.2.0"} -azalea-buf = {path = "../azalea-buf", version = "^0.2.0"} -azalea-chat = {path = "../azalea-chat", version = "^0.2.0"} -azalea-core = {path = "../azalea-core", version = "^0.2.0"} -azalea-nbt = {path = "../azalea-nbt", version = "^0.2.0"} -azalea-registry = {path = "../azalea-registry", version = "^0.2.0"} +azalea-block = {path = "../azalea-block", default-features = false, version = "^0.3.0" } +azalea-buf = {path = "../azalea-buf", version = "^0.3.0" } +azalea-chat = {path = "../azalea-chat", version = "^0.3.0" } +azalea-core = {path = "../azalea-core", version = "^0.3.0" } +azalea-nbt = {path = "../azalea-nbt", version = "^0.3.0" } +azalea-registry = {path = "../azalea-registry", version = "^0.3.0" } log = "0.4.17" nohash-hasher = "0.2.0" thiserror = "1.0.34" diff --git a/azalea/Cargo.toml b/azalea/Cargo.toml index a456d1ea..35387bf1 100644 --- a/azalea/Cargo.toml +++ b/azalea/Cargo.toml @@ -4,15 +4,15 @@ edition = "2021" license = "MIT" name = "azalea" repository = "https://github.com/mat-1/azalea/tree/main/azalea" -version = "0.2.4" +version = "0.3.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] anyhow = "^1.0.65" async-trait = "^0.1.57" -azalea-client = {version = "0.2.2", path = "../azalea-client"} -azalea-protocol = {version = "0.2.0", path = "../azalea-protocol"} +azalea-client = {version = "0.3.0", path = "../azalea-client"} +azalea-protocol = {version = "0.3.0", path = "../azalea-protocol"} parking_lot = "^0.12.1" thiserror = "^1.0.37" tokio = "^1.21.1" From fac4d1afda92adafbd3965c2ee7af8e22852c21d Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Sun, 30 Oct 2022 14:49:46 -0500 Subject: [PATCH 10/18] Create LICENSE.md --- LICENSE.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE.md diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 00000000..148b9d56 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 mat + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 694fd39a911872ec5d29739f9817feb3fa4275c4 Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 30 Oct 2022 15:05:14 -0500 Subject: [PATCH 11/18] add docs.rs badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0bd5b96a..c4aa4c7d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Azalea +![docs.rs](https://img.shields.io/docsrs/azalea) + A collection of Rust crates for making Minecraft bots, clients, and tools.

From c65e1fc6604baf308b8c2b20b94bf527a6721ade Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 30 Oct 2022 15:05:54 -0500 Subject: [PATCH 12/18] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c4aa4c7d..bbba81a5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Azalea -![docs.rs](https://img.shields.io/docsrs/azalea) +[![docs.rs](https://img.shields.io/docsrs/azalea)](https://docs.rs/azalea) A collection of Rust crates for making Minecraft bots, clients, and tools. From 329f8b1784b26e2149f6edb4e969e10bd419a190 Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 30 Oct 2022 15:28:19 -0500 Subject: [PATCH 13/18] more docs --- azalea-chat/src/base_component.rs | 2 +- azalea-chat/src/component.rs | 18 +++++++++++++++++- azalea-chat/src/lib.rs | 4 +++- azalea-chat/src/text_component.rs | 3 ++- azalea-chat/src/translatable_component.rs | 4 ++-- azalea-chat/tests/integration_test.rs | 2 +- azalea-client/src/account.rs | 12 ++++++++++++ azalea-client/src/client.rs | 4 +++- azalea-client/src/lib.rs | 2 +- .../game/clientbound_boss_event_packet.rs | 2 +- .../game/clientbound_chat_preview_packet.rs | 2 +- .../game/clientbound_disconnect_packet.rs | 2 +- .../game/clientbound_map_item_data_packet.rs | 2 +- .../game/clientbound_open_screen_packet.rs | 2 +- .../game/clientbound_player_chat_packet.rs | 2 +- .../clientbound_player_combat_kill_packet.rs | 2 +- .../game/clientbound_player_info_packet.rs | 2 +- .../game/clientbound_resource_pack_packet.rs | 2 +- .../game/clientbound_server_data_packet.rs | 2 +- .../clientbound_set_action_bar_text_packet.rs | 2 +- .../game/clientbound_set_objective_packet.rs | 2 +- .../game/clientbound_set_player_team_packet.rs | 2 +- .../clientbound_set_subtitle_text_packet.rs | 2 +- .../game/clientbound_set_title_text_packet.rs | 2 +- .../game/clientbound_system_chat_packet.rs | 2 +- .../game/clientbound_tab_list_packet.rs | 2 +- .../clientbound_update_advancements_packet.rs | 2 +- .../clientbound_login_disconnect_packet.rs | 2 +- .../clientbound_status_response_packet.rs | 2 +- azalea-world/src/entity/data.rs | 2 +- azalea/src/lib.rs | 15 ++++++++++++++- codegen/lib/code/utils.py | 2 +- 32 files changed, 78 insertions(+), 32 deletions(-) diff --git a/azalea-chat/src/base_component.rs b/azalea-chat/src/base_component.rs index fa39a11c..c2f3513d 100755 --- a/azalea-chat/src/base_component.rs +++ b/azalea-chat/src/base_component.rs @@ -1,4 +1,4 @@ -use crate::{component::Component, style::Style}; +use crate::{style::Style, Component}; #[derive(Clone, Debug)] pub struct BaseComponent { diff --git a/azalea-chat/src/component.rs b/azalea-chat/src/component.rs index 6dd11084..4df3796f 100755 --- a/azalea-chat/src/component.rs +++ b/azalea-chat/src/component.rs @@ -13,6 +13,7 @@ use crate::{ translatable_component::{StringOrComponent, TranslatableComponent}, }; +/// A chat component, basically anything you can see in chat. #[derive(Clone, Debug)] pub enum Component { Text(TextComponent), @@ -57,7 +58,22 @@ impl Component { Ok(None) } - /// Convert this component into an ansi string + /// Convert this component into an + /// [ANSI string](https://en.wikipedia.org/wiki/ANSI_escape_code), so you + /// can print it to your terminal and get styling. + /// + /// # Examples + /// + /// ```rust + /// use azalea_chat::Component; + /// + /// let component = Component::deserialize(&serde_json::json!({ + /// "text": "Hello, world!", + /// "color": "red", + /// })).unwrap(); + /// + /// println!("{}", component.to_ansi()); + /// ``` pub fn to_ansi(&self, default_style: Option<&Style>) -> String { // default the default_style to white if it's not set let default_style: &Style = default_style.unwrap_or(&DEFAULT_STYLE); diff --git a/azalea-chat/src/lib.rs b/azalea-chat/src/lib.rs index b7035e13..01f718eb 100755 --- a/azalea-chat/src/lib.rs +++ b/azalea-chat/src/lib.rs @@ -5,7 +5,9 @@ extern crate lazy_static; pub mod base_component; -pub mod component; +mod component; pub mod style; pub mod text_component; pub mod translatable_component; + +pub use component::Component; diff --git a/azalea-chat/src/text_component.rs b/azalea-chat/src/text_component.rs index 96eef08e..46cb0951 100644 --- a/azalea-chat/src/text_component.rs +++ b/azalea-chat/src/text_component.rs @@ -1,7 +1,8 @@ use std::fmt::Display; -use crate::{base_component::BaseComponent, component::Component, style::ChatFormatting}; +use crate::{base_component::BaseComponent, style::ChatFormatting, Component}; +/// A component that contains text that's the same in all locales. #[derive(Clone, Debug)] pub struct TextComponent { pub base: BaseComponent, diff --git a/azalea-chat/src/translatable_component.rs b/azalea-chat/src/translatable_component.rs index 7c01819b..d187adda 100644 --- a/azalea-chat/src/translatable_component.rs +++ b/azalea-chat/src/translatable_component.rs @@ -1,8 +1,7 @@ use std::fmt::{self, Display, Formatter}; use crate::{ - base_component::BaseComponent, component::Component, style::Style, - text_component::TextComponent, + base_component::BaseComponent, style::Style, text_component::TextComponent, Component, }; #[derive(Clone, Debug)] @@ -11,6 +10,7 @@ pub enum StringOrComponent { Component(Component), } +/// A message whose content depends on the client's language. #[derive(Clone, Debug)] pub struct TranslatableComponent { pub base: BaseComponent, diff --git a/azalea-chat/tests/integration_test.rs b/azalea-chat/tests/integration_test.rs index c2be960e..cc976888 100755 --- a/azalea-chat/tests/integration_test.rs +++ b/azalea-chat/tests/integration_test.rs @@ -1,6 +1,6 @@ use azalea_chat::{ - component::Component, style::{Ansi, ChatFormatting, TextColor}, + Component, }; use serde::Deserialize; use serde_json::Value; diff --git a/azalea-client/src/account.rs b/azalea-client/src/account.rs index 715f2fba..2fedc4f5 100644 --- a/azalea-client/src/account.rs +++ b/azalea-client/src/account.rs @@ -6,6 +6,18 @@ use uuid::Uuid; /// Something that can join Minecraft servers. /// /// To join a server using this account, use [`crate::Client::join`]. +/// +/// # Examples +/// +/// ```rust,no_run +/// use azalea_client::Account; +/// +/// # #[tokio::main] +/// # async fn main() { +/// let account = Account::microsoft("example@example.com").await; +/// // or Account::offline("example"); +/// # } +/// ``` #[derive(Clone, Debug)] pub struct Account { /// The Minecraft username of the account. diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs index ab52b65e..cb87c250 100644 --- a/azalea-client/src/client.rs +++ b/azalea-client/src/client.rs @@ -1,6 +1,6 @@ use crate::{movement::MoveDirection, Account, Player}; use azalea_auth::game_profile::GameProfile; -use azalea_chat::component::Component; +use azalea_chat::Component; use azalea_core::{ChunkPos, ResourceLocation, Vec3}; use azalea_protocol::{ connect::{Connection, ConnectionError, ReadConnection, WriteConnection}, @@ -62,6 +62,7 @@ pub enum Event { Packet(Box), } +/// A chat packet, either a system message or a chat message. #[derive(Debug, Clone)] pub enum ChatPacket { System(ClientboundSystemChatPacket), @@ -69,6 +70,7 @@ pub enum ChatPacket { } impl ChatPacket { + /// Get the message shown in chat for this packet. pub fn message(&self) -> Component { match self { ChatPacket::System(p) => p.content.clone(), diff --git a/azalea-client/src/lib.rs b/azalea-client/src/lib.rs index 265fbf8b..c32bd212 100755 --- a/azalea-client/src/lib.rs +++ b/azalea-client/src/lib.rs @@ -14,7 +14,7 @@ pub mod ping; mod player; pub use account::Account; -pub use client::{Client, ClientInformation, Event, JoinError}; +pub use client::{ChatPacket, Client, ClientInformation, Event, JoinError}; pub use movement::MoveDirection; pub use player::Player; diff --git a/azalea-protocol/src/packets/game/clientbound_boss_event_packet.rs b/azalea-protocol/src/packets/game/clientbound_boss_event_packet.rs index 3bcf10d2..59378d3e 100644 --- a/azalea-protocol/src/packets/game/clientbound_boss_event_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_boss_event_packet.rs @@ -1,7 +1,7 @@ use azalea_buf::{ BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable, }; -use azalea_chat::component::Component; +use azalea_chat::Component; use azalea_protocol_macros::ClientboundGamePacket; use std::io::Cursor; use std::io::Write; diff --git a/azalea-protocol/src/packets/game/clientbound_chat_preview_packet.rs b/azalea-protocol/src/packets/game/clientbound_chat_preview_packet.rs index f6343f73..5a72ae33 100644 --- a/azalea-protocol/src/packets/game/clientbound_chat_preview_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_chat_preview_packet.rs @@ -1,5 +1,5 @@ use azalea_buf::McBuf; -use azalea_chat::component::Component; +use azalea_chat::Component; use azalea_protocol_macros::ClientboundGamePacket; #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] diff --git a/azalea-protocol/src/packets/game/clientbound_disconnect_packet.rs b/azalea-protocol/src/packets/game/clientbound_disconnect_packet.rs index bc4b83cb..ecff0278 100644 --- a/azalea-protocol/src/packets/game/clientbound_disconnect_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_disconnect_packet.rs @@ -1,5 +1,5 @@ use azalea_buf::McBuf; -use azalea_chat::component::Component; +use azalea_chat::Component; use azalea_protocol_macros::ClientboundGamePacket; #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] diff --git a/azalea-protocol/src/packets/game/clientbound_map_item_data_packet.rs b/azalea-protocol/src/packets/game/clientbound_map_item_data_packet.rs index 4ce71a12..07e49687 100644 --- a/azalea-protocol/src/packets/game/clientbound_map_item_data_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_map_item_data_packet.rs @@ -1,6 +1,6 @@ use azalea_buf::{BufReadError, McBuf}; use azalea_buf::{McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable}; -use azalea_chat::component::Component; +use azalea_chat::Component; use azalea_protocol_macros::ClientboundGamePacket; use std::io::{Cursor, Write}; diff --git a/azalea-protocol/src/packets/game/clientbound_open_screen_packet.rs b/azalea-protocol/src/packets/game/clientbound_open_screen_packet.rs index 521975af..f127f587 100644 --- a/azalea-protocol/src/packets/game/clientbound_open_screen_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_open_screen_packet.rs @@ -1,5 +1,5 @@ use azalea_buf::McBuf; -use azalea_chat::component::Component; +use azalea_chat::Component; use azalea_protocol_macros::ClientboundGamePacket; #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] diff --git a/azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs index 3f75e74b..fedc81df 100644 --- a/azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs @@ -1,7 +1,7 @@ use azalea_buf::McBuf; use azalea_chat::{ - component::Component, translatable_component::{StringOrComponent, TranslatableComponent}, + Component, }; use azalea_core::BitSet; use azalea_crypto::{MessageSignature, SignedMessageHeader}; diff --git a/azalea-protocol/src/packets/game/clientbound_player_combat_kill_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_combat_kill_packet.rs index f1294f2e..fa547af1 100644 --- a/azalea-protocol/src/packets/game/clientbound_player_combat_kill_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_player_combat_kill_packet.rs @@ -1,5 +1,5 @@ use azalea_buf::McBuf; -use azalea_chat::component::Component; +use azalea_chat::Component; use azalea_protocol_macros::ClientboundGamePacket; /// Used to send a respawn screen. diff --git a/azalea-protocol/src/packets/game/clientbound_player_info_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_info_packet.rs index 885148a5..84218842 100644 --- a/azalea-protocol/src/packets/game/clientbound_player_info_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_player_info_packet.rs @@ -1,7 +1,7 @@ use crate::packets::login::serverbound_hello_packet::ProfilePublicKeyData; use azalea_buf::{BufReadError, McBuf}; use azalea_buf::{McBufReadable, McBufWritable}; -use azalea_chat::component::Component; +use azalea_chat::Component; use azalea_protocol_macros::ClientboundGamePacket; use std::io::{Cursor, Write}; use uuid::Uuid; diff --git a/azalea-protocol/src/packets/game/clientbound_resource_pack_packet.rs b/azalea-protocol/src/packets/game/clientbound_resource_pack_packet.rs index e31ebaa4..73ade728 100644 --- a/azalea-protocol/src/packets/game/clientbound_resource_pack_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_resource_pack_packet.rs @@ -1,5 +1,5 @@ use azalea_buf::McBuf; -use azalea_chat::component::Component; +use azalea_chat::Component; use azalea_protocol_macros::ClientboundGamePacket; #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] diff --git a/azalea-protocol/src/packets/game/clientbound_server_data_packet.rs b/azalea-protocol/src/packets/game/clientbound_server_data_packet.rs index b1147305..2305cf32 100644 --- a/azalea-protocol/src/packets/game/clientbound_server_data_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_server_data_packet.rs @@ -1,5 +1,5 @@ use azalea_buf::McBuf; -use azalea_chat::component::Component; +use azalea_chat::Component; use azalea_protocol_macros::ClientboundGamePacket; #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] diff --git a/azalea-protocol/src/packets/game/clientbound_set_action_bar_text_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_action_bar_text_packet.rs index aefe072f..e279e33c 100644 --- a/azalea-protocol/src/packets/game/clientbound_set_action_bar_text_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_set_action_bar_text_packet.rs @@ -1,5 +1,5 @@ use azalea_buf::McBuf; -use azalea_chat::component::Component; +use azalea_chat::Component; use azalea_protocol_macros::ClientboundGamePacket; #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] diff --git a/azalea-protocol/src/packets/game/clientbound_set_objective_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_objective_packet.rs index 0e7e334d..ad75a1c3 100644 --- a/azalea-protocol/src/packets/game/clientbound_set_objective_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_set_objective_packet.rs @@ -1,5 +1,5 @@ use azalea_buf::{BufReadError, McBuf, McBufReadable, McBufWritable}; -use azalea_chat::component::Component; +use azalea_chat::Component; use azalea_protocol_macros::ClientboundGamePacket; use std::io::{Cursor, Write}; diff --git a/azalea-protocol/src/packets/game/clientbound_set_player_team_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_player_team_packet.rs index a0754ddd..2550a98c 100644 --- a/azalea-protocol/src/packets/game/clientbound_set_player_team_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_set_player_team_packet.rs @@ -1,5 +1,5 @@ use azalea_buf::{BufReadError, McBuf, McBufReadable, McBufWritable}; -use azalea_chat::{component::Component, style::ChatFormatting}; +use azalea_chat::{style::ChatFormatting, Component}; use azalea_protocol_macros::ClientboundGamePacket; use std::io::{Cursor, Write}; diff --git a/azalea-protocol/src/packets/game/clientbound_set_subtitle_text_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_subtitle_text_packet.rs index d1a3b281..b7d1e7a4 100644 --- a/azalea-protocol/src/packets/game/clientbound_set_subtitle_text_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_set_subtitle_text_packet.rs @@ -1,5 +1,5 @@ use azalea_buf::McBuf; -use azalea_chat::component::Component; +use azalea_chat::Component; use azalea_protocol_macros::ClientboundGamePacket; #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] diff --git a/azalea-protocol/src/packets/game/clientbound_set_title_text_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_title_text_packet.rs index c6e5f0e8..a9185e1a 100644 --- a/azalea-protocol/src/packets/game/clientbound_set_title_text_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_set_title_text_packet.rs @@ -1,5 +1,5 @@ use azalea_buf::McBuf; -use azalea_chat::component::Component; +use azalea_chat::Component; use azalea_protocol_macros::ClientboundGamePacket; #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] diff --git a/azalea-protocol/src/packets/game/clientbound_system_chat_packet.rs b/azalea-protocol/src/packets/game/clientbound_system_chat_packet.rs index 4e5222b7..a3319721 100644 --- a/azalea-protocol/src/packets/game/clientbound_system_chat_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_system_chat_packet.rs @@ -1,5 +1,5 @@ use azalea_buf::McBuf; -use azalea_chat::component::Component; +use azalea_chat::Component; use azalea_protocol_macros::ClientboundGamePacket; #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] diff --git a/azalea-protocol/src/packets/game/clientbound_tab_list_packet.rs b/azalea-protocol/src/packets/game/clientbound_tab_list_packet.rs index 49f357b2..94f23241 100644 --- a/azalea-protocol/src/packets/game/clientbound_tab_list_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_tab_list_packet.rs @@ -1,5 +1,5 @@ use azalea_buf::McBuf; -use azalea_chat::component::Component; +use azalea_chat::Component; use azalea_protocol_macros::ClientboundGamePacket; #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] diff --git a/azalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs index eb52e133..5f63dd1a 100644 --- a/azalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs @@ -1,5 +1,5 @@ use azalea_buf::McBuf; -use azalea_chat::component::Component; +use azalea_chat::Component; use azalea_core::{ResourceLocation, Slot}; use azalea_protocol_macros::ClientboundGamePacket; use std::collections::HashMap; diff --git a/azalea-protocol/src/packets/login/clientbound_login_disconnect_packet.rs b/azalea-protocol/src/packets/login/clientbound_login_disconnect_packet.rs index 2b8144ef..983dc31b 100644 --- a/azalea-protocol/src/packets/login/clientbound_login_disconnect_packet.rs +++ b/azalea-protocol/src/packets/login/clientbound_login_disconnect_packet.rs @@ -1,5 +1,5 @@ use azalea_buf::McBuf; -use azalea_chat::component::Component; +use azalea_chat::Component; use azalea_protocol_macros::ClientboundLoginPacket; #[derive(Clone, Debug, McBuf, ClientboundLoginPacket)] diff --git a/azalea-protocol/src/packets/status/clientbound_status_response_packet.rs b/azalea-protocol/src/packets/status/clientbound_status_response_packet.rs index f8b46b8d..64ea14f9 100755 --- a/azalea-protocol/src/packets/status/clientbound_status_response_packet.rs +++ b/azalea-protocol/src/packets/status/clientbound_status_response_packet.rs @@ -1,5 +1,5 @@ use azalea_buf::{BufReadError, McBufReadable, McBufWritable}; -use azalea_chat::component::Component; +use azalea_chat::Component; use azalea_protocol_macros::ClientboundStatusPacket; use serde::Deserialize; use serde_json::Value; diff --git a/azalea-world/src/entity/data.rs b/azalea-world/src/entity/data.rs index 0f90c790..c73a84d6 100644 --- a/azalea-world/src/entity/data.rs +++ b/azalea-world/src/entity/data.rs @@ -1,6 +1,6 @@ use azalea_buf::{BufReadError, McBufVarReadable}; use azalea_buf::{McBuf, McBufReadable, McBufWritable}; -use azalea_chat::component::Component; +use azalea_chat::Component; use azalea_core::{BlockPos, Direction, GlobalPos, Particle, Slot}; use std::io::{Cursor, Write}; use uuid::Uuid; diff --git a/azalea/src/lib.rs b/azalea/src/lib.rs index 2d0344fc..d9465062 100644 --- a/azalea/src/lib.rs +++ b/azalea/src/lib.rs @@ -94,8 +94,10 @@ where /// The address of the server that we're connecting to. This can be a /// `&str`, [`ServerAddress`], or anything that implements /// `TryInto`. + /// + /// [`ServerAddress`]: azalea_protocol::ServerAddress pub address: A, - /// The account that's going to join the server, + /// The account that's going to join the server. pub account: Account, /// A list of plugins that are going to be used. Plugins are external /// crates that add extra functionality to Azalea. @@ -116,6 +118,17 @@ where /// ``` pub state: S, /// The function that's called whenever we get an event. + /// + /// # Examples + /// + /// ```rust + /// use anyhow::Result; + /// use azalea::prelude::*; + /// + /// async fn handle(bot: Client, event: Event, state: State) -> anyhow::Result<()> { + /// Ok(()) + /// } + /// ``` pub handle: HandleFn, } diff --git a/codegen/lib/code/utils.py b/codegen/lib/code/utils.py index 635dff0b..66b18eed 100644 --- a/codegen/lib/code/utils.py +++ b/codegen/lib/code/utils.py @@ -45,7 +45,7 @@ def burger_type_to_rust_type(burger_type, field_name: Optional[str] = None, inst elif burger_type == 'chatcomponent': field_type_rs = 'Component' - uses.add('azalea_chat::component::Component') + uses.add('azalea_chat::Component') elif burger_type == 'identifier': field_type_rs = 'ResourceLocation' uses.add('azalea_core::ResourceLocation') From 5ae890f94178d824fb73b4bbd2938dff9c22e96e Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 30 Oct 2022 15:42:43 -0500 Subject: [PATCH 14/18] replace an expect with unwrap_or_else --- azalea-client/src/account.rs | 7 +++---- azalea/src/lib.rs | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/azalea-client/src/account.rs b/azalea-client/src/account.rs index 2fedc4f5..42bfe6fc 100644 --- a/azalea-client/src/account.rs +++ b/azalea-client/src/account.rs @@ -46,13 +46,12 @@ impl Account { /// a key for the cache, but it's recommended to use the real email to /// avoid confusion. pub async fn microsoft(email: &str) -> Result { - let minecraft_dir = get_mc_dir::minecraft_dir().expect( - format!( + let minecraft_dir = get_mc_dir::minecraft_dir().unwrap_or_else(|| { + panic!( "No {} environment variable found", get_mc_dir::home_env_var() ) - .as_str(), - ); + }); let auth_result = azalea_auth::auth( email, azalea_auth::AuthOpts { diff --git a/azalea/src/lib.rs b/azalea/src/lib.rs index d9465062..636981f3 100644 --- a/azalea/src/lib.rs +++ b/azalea/src/lib.rs @@ -122,7 +122,6 @@ where /// # Examples /// /// ```rust - /// use anyhow::Result; /// use azalea::prelude::*; /// /// async fn handle(bot: Client, event: Event, state: State) -> anyhow::Result<()> { From 261913e606d7b8bdc96a51f41f23766f87ad9568 Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 30 Oct 2022 21:42:32 -0500 Subject: [PATCH 15/18] reply to custom query packet --- azalea-client/src/client.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs index cb87c250..4ed2be2c 100644 --- a/azalea-client/src/client.rs +++ b/azalea-client/src/client.rs @@ -226,6 +226,11 @@ impl Client { } ClientboundLoginPacket::CustomQuery(p) => { debug!("Got custom query {:?}", p); + conn.write(ServerboundCustomQueryPacket { + transaction_id: p.transaction_id, + data: None, + }) + .await?; } } }; From aea53cd380f9e2b294ee88bccba73171df48f7da Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 30 Oct 2022 21:44:11 -0500 Subject: [PATCH 16/18] actually fix --- azalea-client/src/client.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs index 4ed2be2c..f19178c2 100644 --- a/azalea-client/src/client.rs +++ b/azalea-client/src/client.rs @@ -17,6 +17,7 @@ use azalea_protocol::{ }, handshake::client_intention_packet::ClientIntentionPacket, login::{ + serverbound_custom_query_packet::ServerboundCustomQueryPacket, serverbound_hello_packet::ServerboundHelloPacket, serverbound_key_packet::{NonceOrSaltSignature, ServerboundKeyPacket}, ClientboundLoginPacket, @@ -226,10 +227,13 @@ impl Client { } ClientboundLoginPacket::CustomQuery(p) => { debug!("Got custom query {:?}", p); - conn.write(ServerboundCustomQueryPacket { - transaction_id: p.transaction_id, - data: None, - }) + conn.write( + ServerboundCustomQueryPacket { + transaction_id: p.transaction_id, + data: None, + } + .get(), + ) .await?; } } From e234f8b7566bb0672361253b15e08c55b87275c7 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Mon, 31 Oct 2022 15:37:41 +0000 Subject: [PATCH 17/18] add basic installation instructions --- azalea/src/lib.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/azalea/src/lib.rs b/azalea/src/lib.rs index 636981f3..4a042b79 100644 --- a/azalea/src/lib.rs +++ b/azalea/src/lib.rs @@ -5,6 +5,17 @@ //! refer to `azalea_client`. You can just replace these with `azalea` in your //! code, since everything from azalea_client is re-exported in azalea. //! +//! # Installation +//! +//! First, install Rust nightly with `rustup install nightly` and `rustup +//! default nightly`. +//! +//! Then, add one of the following lines to your Cargo.toml.\ +//! Latest bleeding-edge version: +//! `azalea = { git="https://github.com/mat-1/Cargo.toml" }` +//! Latest "stable" release: +//! `azalea = "0.3"` +//! //! # Examples //! //! ```rust,no_run From 50f1cc47fa8a115d59dad2df941875bf741bbf88 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Mon, 31 Oct 2022 15:56:15 +0000 Subject: [PATCH 18/18] some -> most in readme warning --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bbba81a5..92caf0fe 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ A collection of Rust crates for making Minecraft bots, clients, and tools. *Currently supported Minecraft version: `1.19.2`.* -## ⚠️ Azalea is still very unfinished, though some crates are in a somewhat useable state +## ⚠️ Azalea is still very unfinished, though most crates are in a somewhat useable state I named this Azalea because it sounds like a cool word and this is a cool library.