Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into custom_auth
Browse files Browse the repository at this point in the history
  • Loading branch information
1zun4 committed Jun 8, 2024
2 parents 86c165e + c7f9dc4 commit 157e711
Show file tree
Hide file tree
Showing 128 changed files with 13,902 additions and 14,953 deletions.
1,080 changes: 534 additions & 546 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ A collection of Rust crates for making Minecraft bots, clients, and tools.

<!-- The line below is automatically read and updated by the migrate script, so don't change it manually. -->

_Currently supported Minecraft version: `1.20.4`._
_Currently supported Minecraft version: `1.20.6`._

> [!WARNING]
> Azalea is still very unfinished, though most crates are in a somewhat useable state
Expand Down Expand Up @@ -53,6 +53,7 @@ If you'd like to chat about Azalea, you can join the Matrix space at [#azalea:ma

There are several branches in the Azalea repository that target older Minecraft versions. It is not guaranteed that they will be up-to-date with the latest version of Azalea. If you'd like to update them or add more, please open a PR.

- [1.20.4](https://github.com/azalea-rs/azalea/tree/1.20.4)
- [1.20.2](https://github.com/azalea-rs/azalea/tree/1.20.2)
- [1.20-1.20.1](https://github.com/azalea-rs/azalea/tree/1.20.1)
- [1.19.4](https://github.com/azalea-rs/azalea/tree/1.19.4)
Expand Down
26 changes: 13 additions & 13 deletions azalea-auth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,30 @@ edition = "2021"
license = "MIT"
name = "azalea-auth"
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-auth"
version = "0.9.0"
version = "0.10.1"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
azalea-buf = { path = "../azalea-buf", version = "0.9.0" }
azalea-crypto = { path = "../azalea-crypto", version = "0.9.0" }
base64 = "0.21.7"
chrono = { version = "0.4.34", default-features = false, features = ["serde"] }
azalea-buf = { path = "../azalea-buf", version = "0.10.0" }
azalea-crypto = { path = "../azalea-crypto", version = "0.10.0" }
base64 = "0.22.0"
chrono = { version = "0.4.38", default-features = false, features = ["serde"] }
tracing = "0.1.40"
num-bigint = "0.4.4"
once_cell = "1.19.0"
reqwest = { version = "0.11.24", default-features = false, features = [
reqwest = { version = "0.12.4", default-features = false, features = [
"json",
"rustls-tls",
] }
rsa = "0.9.6"
serde = { version = "1.0.196", features = ["derive"] }
serde_json = "1.0.113"
thiserror = "1.0.57"
tokio = { version = "1.36.0", features = ["fs"] }
uuid = { version = "1.7.0", features = ["serde", "v3"] }
serde = { version = "1.0.198", features = ["derive"] }
serde_json = "1.0.116"
thiserror = "1.0.59"
tokio = { version = "1.37.0", features = ["fs"] }
uuid = { version = "1.8.0", features = ["serde", "v3"] }
md-5 = "0.10.6"

[dev-dependencies]
env_logger = "0.11.2"
tokio = { version = "1.36.0", features = ["full"] }
env_logger = "0.11.3"
tokio = { version = "1.37.0", features = ["full"] }
8 changes: 4 additions & 4 deletions azalea-block/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ edition = "2021"
license = "MIT"
name = "azalea-block"
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-block"
version = "0.9.0"
version = "0.10.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.9.0" }
azalea-buf = { path = "../azalea-buf", version = "0.9.0" }
azalea-registry = { version = "0.9.0", path = "../azalea-registry" }
azalea-block-macros = { path = "./azalea-block-macros", version = "0.10.0" }
azalea-buf = { path = "../azalea-buf", version = "0.10.0" }
azalea-registry = { version = "0.10.0", path = "../azalea-registry" }
8 changes: 4 additions & 4 deletions azalea-block/azalea-block-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ edition = "2021"
license = "MIT"
name = "azalea-block-macros"
repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-block/azalea-block-macros"
version = "0.9.0"
version = "0.10.0"

[lib]
proc-macro = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
proc-macro2 = "1.0.78"
quote = "1.0.35"
syn = "2.0.49"
proc-macro2 = "1.0.81"
quote = "1.0.36"
syn = "2.0.60"
52 changes: 25 additions & 27 deletions azalea-block/azalea-block-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ struct PropertyDefinitions {
properties: Vec<PropertyDefinition>,
}

/// `snowy: Snowy(false)` or `axis: properties::Axis::Y`
/// `"snowy": Snowy(false)` or `"axis": properties::Axis::Y`
#[derive(Debug)]
struct PropertyWithNameAndDefault {
// "snowy" / "axis"
name: Ident,
name: String,
// Snowy / Axis
property_type: Ident,
property_value_type: Ident,
Expand All @@ -54,7 +54,7 @@ struct PropertyWithNameAndDefault {

/// ```ignore
/// grass_block => BlockBehavior::default(), {
/// snowy: false,
/// "snowy": false,
/// },
/// ```
struct BlockDefinition {
Expand All @@ -64,8 +64,8 @@ struct BlockDefinition {
}
impl Parse for PropertyWithNameAndDefault {
fn parse(input: ParseStream) -> Result<Self> {
// `snowy: Snowy(false)` or `axis: properties::Axis::Y`
let property_name = input.parse()?;
// `"snowy": Snowy(false)` or `"axis": properties::Axis::Y`
let property_name = input.parse::<LitStr>()?.value();
input.parse::<Token![:]>()?;

let first_ident = input.call(Ident::parse_any)?;
Expand Down Expand Up @@ -196,11 +196,11 @@ impl Parse for PropertyDefinitions {

impl Parse for BlockDefinition {
fn parse(input: ParseStream) -> Result<Self> {
// acacia_button => BlockBehavior::default(), {
// Facing=North,
// Powered=False,
// Face=Wall,
// }
// acacia_button => BlockBehavior::new().strength(0.5, 0.5), {
// "face": Face::Wall,
// "facing": FacingCardinal::North,
// "powered": Powered(false),
// },
let name = input.parse()?;
input.parse::<Token![=>]>()?;
let behavior = input.parse()?;
Expand Down Expand Up @@ -416,29 +416,24 @@ pub fn make_block_states(input: TokenStream) -> TokenStream {
Some(
previous_names
.iter()
.filter(|&p| p == &property.name.to_string())
.filter(|&p| p == &property.name)
.count(),
)
} else {
None
};
// ```ignore
// let mut property_name = property_struct_names_to_names
// .get(&property.property_type.to_string())
// .unwrap_or_else(|| panic!("Property '{}' is bad", property.property_type))
// .clone();
// ```

let mut property_name = property_struct_names_to_names
.get(&property.name.to_string())
.get(&property.name)
.cloned()
.unwrap_or_else(|| property.name.to_string());
.unwrap_or_else(|| property.name.clone());
previous_names.push(property_name.clone());
if let Some(index) = index {
// property_name.push_str(&format!("_{}", &index.to_string()));
write!(property_name, "_{index}").unwrap();
}
properties_with_name.push(PropertyWithNameAndDefault {
name: Ident::new(&property_name, proc_macro2::Span::call_site()),
name: property_name,
property_type: property.property_type.clone(),
property_value_type: property.property_value_type.clone(),
is_enum: property.is_enum,
Expand All @@ -462,12 +457,11 @@ pub fn make_block_states(input: TokenStream) -> TokenStream {
..
} in &properties_with_name
{
// let property_name_snake =
// Ident::new(&property.to_string(), proc_macro2::Span::call_site());
let name_ident = Ident::new_raw(name, proc_macro2::Span::call_site());
block_struct_fields.extend(if *is_enum {
quote! { pub #name: properties::#property_value_type, }
quote! { pub #name_ident: properties::#property_value_type, }
} else {
quote! { pub #name: #property_value_type, }
quote! { pub #name_ident: #property_value_type, }
});
}

Expand Down Expand Up @@ -525,8 +519,10 @@ pub fn make_block_states(input: TokenStream) -> TokenStream {
quote! {#variant}
};

let property_name_ident =
Ident::new_raw(property_name, proc_macro2::Span::call_site());
from_block_to_state_combination_match_inner.extend(quote! {
#property_name: #property_variant,
#property_name_ident: #property_variant,
});

// add to properties_to_state_ids
Expand Down Expand Up @@ -602,8 +598,9 @@ pub fn make_block_states(input: TokenStream) -> TokenStream {
quote! {properties::#property_struct_name_ident::from((b / #division) % #property_variants_count)}
}
};
let property_name_ident = Ident::new_raw(property_name, proc_macro2::Span::call_site());
from_state_to_block_inner.extend(quote! {
#property_name: #conversion_code,
#property_name_ident: #conversion_code,
});

division *= property_variants_count;
Expand Down Expand Up @@ -635,7 +632,8 @@ pub fn make_block_states(input: TokenStream) -> TokenStream {
..
} in properties_with_name
{
block_default_fields.extend(quote! { #name: #property_default, });
let name_ident = Ident::new_raw(&name, proc_macro2::Span::call_site());
block_default_fields.extend(quote! { #name_ident: #property_default, });
}

let block_behavior = &block.behavior;
Expand Down
Loading

0 comments on commit 157e711

Please sign in to comment.