build(deps): update azalea
This commit is contained in:
parent
505b1a26af
commit
5189aacbfc
69
Cargo.lock
generated
69
Cargo.lock
generated
@ -261,6 +261,19 @@ dependencies = [
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-compat"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7bab94bde396a3f7b4962e396fdad640e241ed797d4d8d77fc8c237d14c58fc0"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-io",
|
||||
"once_cell",
|
||||
"pin-project-lite",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-compression"
|
||||
version = "0.4.22"
|
||||
@ -399,7 +412,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "azalea"
|
||||
version = "0.12.0+mc1.21.5"
|
||||
source = "git+https://github.com/azalea-rs/azalea#6a83a6fa387170ae71fbe06791cf3afa20aac1df"
|
||||
source = "git+https://github.com/azalea-rs/azalea#3f60bdadac1a02e1109148bbbe5a8a3545f13849"
|
||||
dependencies = [
|
||||
"azalea-auth",
|
||||
"azalea-block",
|
||||
@ -437,7 +450,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "azalea-auth"
|
||||
version = "0.12.0+mc1.21.5"
|
||||
source = "git+https://github.com/azalea-rs/azalea#6a83a6fa387170ae71fbe06791cf3afa20aac1df"
|
||||
source = "git+https://github.com/azalea-rs/azalea#3f60bdadac1a02e1109148bbbe5a8a3545f13849"
|
||||
dependencies = [
|
||||
"azalea-buf",
|
||||
"azalea-crypto",
|
||||
@ -457,7 +470,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "azalea-block"
|
||||
version = "0.12.0+mc1.21.5"
|
||||
source = "git+https://github.com/azalea-rs/azalea#6a83a6fa387170ae71fbe06791cf3afa20aac1df"
|
||||
source = "git+https://github.com/azalea-rs/azalea#3f60bdadac1a02e1109148bbbe5a8a3545f13849"
|
||||
dependencies = [
|
||||
"azalea-block-macros",
|
||||
"azalea-buf",
|
||||
@ -467,7 +480,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "azalea-block-macros"
|
||||
version = "0.12.0+mc1.21.5"
|
||||
source = "git+https://github.com/azalea-rs/azalea#6a83a6fa387170ae71fbe06791cf3afa20aac1df"
|
||||
source = "git+https://github.com/azalea-rs/azalea#3f60bdadac1a02e1109148bbbe5a8a3545f13849"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -477,7 +490,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "azalea-brigadier"
|
||||
version = "0.12.0+mc1.21.5"
|
||||
source = "git+https://github.com/azalea-rs/azalea#6a83a6fa387170ae71fbe06791cf3afa20aac1df"
|
||||
source = "git+https://github.com/azalea-rs/azalea#3f60bdadac1a02e1109148bbbe5a8a3545f13849"
|
||||
dependencies = [
|
||||
"azalea-buf",
|
||||
"azalea-chat",
|
||||
@ -487,7 +500,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "azalea-buf"
|
||||
version = "0.12.0+mc1.21.5"
|
||||
source = "git+https://github.com/azalea-rs/azalea#6a83a6fa387170ae71fbe06791cf3afa20aac1df"
|
||||
source = "git+https://github.com/azalea-rs/azalea#3f60bdadac1a02e1109148bbbe5a8a3545f13849"
|
||||
dependencies = [
|
||||
"azalea-buf-macros",
|
||||
"byteorder",
|
||||
@ -501,7 +514,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "azalea-buf-macros"
|
||||
version = "0.12.0+mc1.21.5"
|
||||
source = "git+https://github.com/azalea-rs/azalea#6a83a6fa387170ae71fbe06791cf3afa20aac1df"
|
||||
source = "git+https://github.com/azalea-rs/azalea#3f60bdadac1a02e1109148bbbe5a8a3545f13849"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -511,7 +524,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "azalea-chat"
|
||||
version = "0.12.0+mc1.21.5"
|
||||
source = "git+https://github.com/azalea-rs/azalea#6a83a6fa387170ae71fbe06791cf3afa20aac1df"
|
||||
source = "git+https://github.com/azalea-rs/azalea#3f60bdadac1a02e1109148bbbe5a8a3545f13849"
|
||||
dependencies = [
|
||||
"azalea-buf",
|
||||
"azalea-language",
|
||||
@ -525,8 +538,9 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "azalea-client"
|
||||
version = "0.12.0+mc1.21.5"
|
||||
source = "git+https://github.com/azalea-rs/azalea#6a83a6fa387170ae71fbe06791cf3afa20aac1df"
|
||||
source = "git+https://github.com/azalea-rs/azalea#3f60bdadac1a02e1109148bbbe5a8a3545f13849"
|
||||
dependencies = [
|
||||
"async-compat",
|
||||
"azalea-auth",
|
||||
"azalea-block",
|
||||
"azalea-buf",
|
||||
@ -560,7 +574,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "azalea-core"
|
||||
version = "0.12.0+mc1.21.5"
|
||||
source = "git+https://github.com/azalea-rs/azalea#6a83a6fa387170ae71fbe06791cf3afa20aac1df"
|
||||
source = "git+https://github.com/azalea-rs/azalea#3f60bdadac1a02e1109148bbbe5a8a3545f13849"
|
||||
dependencies = [
|
||||
"azalea-buf",
|
||||
"azalea-chat",
|
||||
@ -577,7 +591,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "azalea-crypto"
|
||||
version = "0.12.0+mc1.21.5"
|
||||
source = "git+https://github.com/azalea-rs/azalea#6a83a6fa387170ae71fbe06791cf3afa20aac1df"
|
||||
source = "git+https://github.com/azalea-rs/azalea#3f60bdadac1a02e1109148bbbe5a8a3545f13849"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"azalea-buf",
|
||||
@ -594,7 +608,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "azalea-entity"
|
||||
version = "0.12.0+mc1.21.5"
|
||||
source = "git+https://github.com/azalea-rs/azalea#6a83a6fa387170ae71fbe06791cf3afa20aac1df"
|
||||
source = "git+https://github.com/azalea-rs/azalea#3f60bdadac1a02e1109148bbbe5a8a3545f13849"
|
||||
dependencies = [
|
||||
"azalea-block",
|
||||
"azalea-buf",
|
||||
@ -618,7 +632,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "azalea-inventory"
|
||||
version = "0.12.0+mc1.21.5"
|
||||
source = "git+https://github.com/azalea-rs/azalea#6a83a6fa387170ae71fbe06791cf3afa20aac1df"
|
||||
source = "git+https://github.com/azalea-rs/azalea#3f60bdadac1a02e1109148bbbe5a8a3545f13849"
|
||||
dependencies = [
|
||||
"azalea-buf",
|
||||
"azalea-chat",
|
||||
@ -634,7 +648,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "azalea-inventory-macros"
|
||||
version = "0.12.0+mc1.21.5"
|
||||
source = "git+https://github.com/azalea-rs/azalea#6a83a6fa387170ae71fbe06791cf3afa20aac1df"
|
||||
source = "git+https://github.com/azalea-rs/azalea#3f60bdadac1a02e1109148bbbe5a8a3545f13849"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -644,7 +658,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "azalea-language"
|
||||
version = "0.12.0+mc1.21.5"
|
||||
source = "git+https://github.com/azalea-rs/azalea#6a83a6fa387170ae71fbe06791cf3afa20aac1df"
|
||||
source = "git+https://github.com/azalea-rs/azalea#3f60bdadac1a02e1109148bbbe5a8a3545f13849"
|
||||
dependencies = [
|
||||
"compact_str",
|
||||
"serde",
|
||||
@ -654,7 +668,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "azalea-physics"
|
||||
version = "0.12.0+mc1.21.5"
|
||||
source = "git+https://github.com/azalea-rs/azalea#6a83a6fa387170ae71fbe06791cf3afa20aac1df"
|
||||
source = "git+https://github.com/azalea-rs/azalea#3f60bdadac1a02e1109148bbbe5a8a3545f13849"
|
||||
dependencies = [
|
||||
"azalea-block",
|
||||
"azalea-core",
|
||||
@ -671,7 +685,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "azalea-protocol"
|
||||
version = "0.12.0+mc1.21.5"
|
||||
source = "git+https://github.com/azalea-rs/azalea#6a83a6fa387170ae71fbe06791cf3afa20aac1df"
|
||||
source = "git+https://github.com/azalea-rs/azalea#3f60bdadac1a02e1109148bbbe5a8a3545f13849"
|
||||
dependencies = [
|
||||
"async-recursion",
|
||||
"azalea-auth",
|
||||
@ -706,7 +720,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "azalea-protocol-macros"
|
||||
version = "0.12.0+mc1.21.5"
|
||||
source = "git+https://github.com/azalea-rs/azalea#6a83a6fa387170ae71fbe06791cf3afa20aac1df"
|
||||
source = "git+https://github.com/azalea-rs/azalea#3f60bdadac1a02e1109148bbbe5a8a3545f13849"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -716,7 +730,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "azalea-registry"
|
||||
version = "0.12.0+mc1.21.5"
|
||||
source = "git+https://github.com/azalea-rs/azalea#6a83a6fa387170ae71fbe06791cf3afa20aac1df"
|
||||
source = "git+https://github.com/azalea-rs/azalea#3f60bdadac1a02e1109148bbbe5a8a3545f13849"
|
||||
dependencies = [
|
||||
"azalea-buf",
|
||||
"azalea-registry-macros",
|
||||
@ -727,7 +741,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "azalea-registry-macros"
|
||||
version = "0.12.0+mc1.21.5"
|
||||
source = "git+https://github.com/azalea-rs/azalea#6a83a6fa387170ae71fbe06791cf3afa20aac1df"
|
||||
source = "git+https://github.com/azalea-rs/azalea#3f60bdadac1a02e1109148bbbe5a8a3545f13849"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn",
|
||||
@ -736,7 +750,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "azalea-world"
|
||||
version = "0.12.0+mc1.21.5"
|
||||
source = "git+https://github.com/azalea-rs/azalea#6a83a6fa387170ae71fbe06791cf3afa20aac1df"
|
||||
source = "git+https://github.com/azalea-rs/azalea#3f60bdadac1a02e1109148bbbe5a8a3545f13849"
|
||||
dependencies = [
|
||||
"azalea-block",
|
||||
"azalea-buf",
|
||||
@ -2280,7 +2294,7 @@ dependencies = [
|
||||
"idna",
|
||||
"ipnet",
|
||||
"once_cell",
|
||||
"rand 0.9.0",
|
||||
"rand 0.9.1",
|
||||
"ring",
|
||||
"thiserror 2.0.12",
|
||||
"tinyvec",
|
||||
@ -2301,7 +2315,7 @@ dependencies = [
|
||||
"moka",
|
||||
"once_cell",
|
||||
"parking_lot",
|
||||
"rand 0.9.0",
|
||||
"rand 0.9.1",
|
||||
"smallvec",
|
||||
"thiserror 2.0.12",
|
||||
"tokio",
|
||||
@ -3988,7 +4002,7 @@ checksum = "b820744eb4dc9b57a3398183639c511b5a26d2ed702cedd3febaa1393caa22cc"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"getrandom 0.3.2",
|
||||
"rand 0.9.0",
|
||||
"rand 0.9.1",
|
||||
"ring",
|
||||
"rustc-hash 2.1.1",
|
||||
"rustls",
|
||||
@ -4042,13 +4056,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.9.0"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94"
|
||||
checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97"
|
||||
dependencies = [
|
||||
"rand_chacha 0.9.0",
|
||||
"rand_core 0.9.3",
|
||||
"zerocopy 0.8.24",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -5379,7 +5392,7 @@ version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "470dbf6591da1b39d43c14523b2b469c86879a53e8b758c8e090a470fe7b1fbe"
|
||||
dependencies = [
|
||||
"rand 0.9.0",
|
||||
"rand 0.9.1",
|
||||
"web-time",
|
||||
]
|
||||
|
||||
|
@ -125,7 +125,6 @@ pub async fn handle_event(client: Client, event: Event, state: State) -> Result<
|
||||
}
|
||||
}
|
||||
Event::KeepAlive(id) => call_listeners(&state, "keep_alive", || Ok(id)).await,
|
||||
Event::Login => call_listeners(&state, "login", || Ok(())).await,
|
||||
Event::RemovePlayer(player_info) => {
|
||||
call_listeners(&state, "remove_player", || Ok(Player::from(player_info))).await
|
||||
}
|
||||
@ -201,6 +200,12 @@ pub async fn handle_event(client: Client, event: Event, state: State) -> Result<
|
||||
}
|
||||
_ => Ok(()),
|
||||
},
|
||||
Event::Login => {
|
||||
#[cfg(feature = "matrix")]
|
||||
matrix_init(&client, state.clone());
|
||||
|
||||
call_listeners(&state, "login", || Ok(())).await
|
||||
}
|
||||
Event::Init => {
|
||||
debug!("received init event");
|
||||
|
||||
@ -212,9 +217,6 @@ pub async fn handle_event(client: Client, event: Event, state: State) -> Result<
|
||||
exit(0);
|
||||
})?;
|
||||
|
||||
#[cfg(feature = "matrix")]
|
||||
matrix_init(&client, state.clone());
|
||||
|
||||
let globals = state.lua.globals();
|
||||
lua_init(client, &state, &globals).await?;
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
pub mod anti_knockback;
|
||||
|
||||
use anti_knockback::anti_knockback;
|
||||
use azalea::{movement::handle_knockback, packet::game::process_packet_events};
|
||||
use azalea::{connection::read_packets, movement::handle_knockback};
|
||||
use bevy_app::{App, Plugin, PreUpdate};
|
||||
use bevy_ecs::schedule::IntoSystemConfigs;
|
||||
|
||||
@ -13,9 +13,7 @@ impl Plugin for HacksPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_systems(
|
||||
PreUpdate,
|
||||
anti_knockback
|
||||
.after(process_packet_events)
|
||||
.before(handle_knockback),
|
||||
anti_knockback.after(read_packets).before(handle_knockback),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ pub async fn get_block_states(
|
||||
true
|
||||
})
|
||||
{
|
||||
matched.push(block.id);
|
||||
matched.push(block.id());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ use azalea::{
|
||||
prelude::ContainerClientExt,
|
||||
protocol::packets::game::ServerboundSetCarriedItem,
|
||||
};
|
||||
use log::error;
|
||||
use mlua::{Lua, Result, UserDataRef, Value};
|
||||
|
||||
use super::{Client, Container, ContainerRef, ItemStack, Vec3};
|
||||
@ -126,11 +125,8 @@ pub fn set_held_slot(_lua: &Lua, client: &Client, slot: u8) -> Result<()> {
|
||||
inventory.selected_hotbar_slot = slot;
|
||||
};
|
||||
|
||||
if let Err(error) = client.write_packet(ServerboundSetCarriedItem {
|
||||
client.write_packet(ServerboundSetCarriedItem {
|
||||
slot: u16::from(slot),
|
||||
}) {
|
||||
error!("failed to send SetCarriedItem packet: {error:?}");
|
||||
}
|
||||
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ use azalea::{
|
||||
protocol::packets::game::{ServerboundUseItem, s_interact::InteractionHand},
|
||||
world::MinecraftEntityId,
|
||||
};
|
||||
use log::error;
|
||||
use mlua::{Lua, Result, UserDataRef};
|
||||
|
||||
use super::{Client, Vec3};
|
||||
@ -57,7 +56,7 @@ pub fn start_mining(_lua: &Lua, client: &Client, position: Vec3) -> Result<()> {
|
||||
|
||||
pub fn use_item(_lua: &Lua, client: &Client, hand: Option<u8>) -> Result<()> {
|
||||
let direction = client.direction();
|
||||
if let Err(error) = client.write_packet(ServerboundUseItem {
|
||||
client.write_packet(ServerboundUseItem {
|
||||
hand: match hand {
|
||||
Some(1) => InteractionHand::OffHand,
|
||||
_ => InteractionHand::MainHand,
|
||||
@ -65,8 +64,6 @@ pub fn use_item(_lua: &Lua, client: &Client, hand: Option<u8>) -> Result<()> {
|
||||
sequence: 0,
|
||||
yaw: direction.0,
|
||||
pitch: direction.1,
|
||||
}) {
|
||||
error!("failed to send UseItem packet: {error:?}");
|
||||
}
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ use azalea::{
|
||||
protocol::packets::game::{ServerboundPlayerCommand, s_player_command::Action},
|
||||
world::MinecraftEntityId,
|
||||
};
|
||||
use log::error;
|
||||
use mlua::{FromLua, Lua, Result, Table, UserDataRef, Value};
|
||||
|
||||
use super::{Client, Direction, Vec3};
|
||||
@ -215,7 +214,7 @@ pub fn set_position(_lua: &Lua, client: &Client, new_position: Vec3) -> Result<(
|
||||
}
|
||||
|
||||
pub fn set_sneaking(_lua: &Lua, client: &Client, sneaking: bool) -> Result<()> {
|
||||
if let Err(error) = client.write_packet(ServerboundPlayerCommand {
|
||||
client.write_packet(ServerboundPlayerCommand {
|
||||
id: client.component::<MinecraftEntityId>(),
|
||||
action: if sneaking {
|
||||
Action::PressShiftKey
|
||||
@ -223,9 +222,7 @@ pub fn set_sneaking(_lua: &Lua, client: &Client, sneaking: bool) -> Result<()> {
|
||||
Action::ReleaseShiftKey
|
||||
},
|
||||
data: 0,
|
||||
}) {
|
||||
error!("failed to send PlayerCommand packet: {error:?}");
|
||||
}
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@ -244,13 +241,11 @@ pub fn stop_pathfinding(_lua: &Lua, client: &Client, (): ()) -> Result<()> {
|
||||
}
|
||||
|
||||
pub fn stop_sleeping(_lua: &Lua, client: &Client, (): ()) -> Result<()> {
|
||||
if let Err(error) = client.write_packet(ServerboundPlayerCommand {
|
||||
client.write_packet(ServerboundPlayerCommand {
|
||||
id: client.component::<MinecraftEntityId>(),
|
||||
action: Action::StopSleeping,
|
||||
data: 0,
|
||||
}) {
|
||||
error!("failed to send PlayerCommand packet: {error:?}");
|
||||
}
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -40,21 +40,22 @@ pub async fn set_client_information(
|
||||
allows_listing: info.get("allows_listing")?,
|
||||
model_customization: info
|
||||
.get::<Table>("model_customization")
|
||||
.as_ref()
|
||||
.map(|t| ModelCustomization {
|
||||
cape: get_bool(&t, "cape"),
|
||||
jacket: get_bool(&t, "jacket"),
|
||||
left_sleeve: get_bool(&t, "left_sleeve"),
|
||||
right_sleeve: get_bool(&t, "right_sleeve"),
|
||||
left_pants: get_bool(&t, "left_pants"),
|
||||
right_pants: get_bool(&t, "right_pants"),
|
||||
hat: get_bool(&t, "hat"),
|
||||
cape: get_bool(t, "cape"),
|
||||
jacket: get_bool(t, "jacket"),
|
||||
left_sleeve: get_bool(t, "left_sleeve"),
|
||||
right_sleeve: get_bool(t, "right_sleeve"),
|
||||
left_pants: get_bool(t, "left_pants"),
|
||||
right_pants: get_bool(t, "right_pants"),
|
||||
hat: get_bool(t, "hat"),
|
||||
})
|
||||
.unwrap_or_default(),
|
||||
view_distance: info.get("view_distance").unwrap_or(8),
|
||||
..ClientInformation::default()
|
||||
})
|
||||
.await
|
||||
.map_err(Error::external)
|
||||
.await;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn set_component(
|
||||
|
@ -28,7 +28,10 @@ pub fn blocks(
|
||||
nearest_to.z as i32,
|
||||
),
|
||||
&BlockStates {
|
||||
set: block_states.iter().map(|&id| BlockState { id }).collect(),
|
||||
set: block_states
|
||||
.into_iter()
|
||||
.flat_map(BlockState::try_from)
|
||||
.collect(),
|
||||
},
|
||||
)
|
||||
.map(Vec3::from)
|
||||
|
@ -3,16 +3,19 @@ mod queries;
|
||||
pub mod find;
|
||||
|
||||
use azalea::{BlockPos, auto_tool::AutoToolClientExt, blocks::BlockState, world::InstanceName};
|
||||
use mlua::{Lua, Result, Table};
|
||||
use mlua::{Lua, Result, Table, Value};
|
||||
|
||||
use super::{Client, Direction, Vec3};
|
||||
|
||||
pub fn best_tool_for_block(lua: &Lua, client: &Client, block_state: u16) -> Result<Table> {
|
||||
let result = client.best_tool_in_hotbar_for_block(BlockState { id: block_state });
|
||||
pub fn best_tool_for_block(lua: &Lua, client: &Client, block_state: u16) -> Result<Value> {
|
||||
let Ok(block) = BlockState::try_from(block_state) else {
|
||||
return Ok(Value::Nil);
|
||||
};
|
||||
let result = client.best_tool_in_hotbar_for_block(block);
|
||||
let table = lua.create_table()?;
|
||||
table.set("index", result.index)?;
|
||||
table.set("percentage_per_tick", result.percentage_per_tick)?;
|
||||
Ok(table)
|
||||
Ok(Value::Table(table))
|
||||
}
|
||||
|
||||
pub fn dimension(_lua: &Lua, client: &Client) -> Result<String> {
|
||||
@ -29,7 +32,7 @@ pub fn get_block_state(_lua: &Lua, client: &Client, position: Vec3) -> Result<Op
|
||||
position.y as i32,
|
||||
position.z as i32,
|
||||
))
|
||||
.map(|block| block.id))
|
||||
.map(|block| block.id()))
|
||||
}
|
||||
|
||||
#[allow(clippy::cast_possible_truncation)]
|
||||
|
@ -22,7 +22,7 @@ use std::{
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
use anyhow::Context;
|
||||
use anyhow::{Context, Result};
|
||||
use arguments::Arguments;
|
||||
use azalea::{
|
||||
DefaultBotPlugins, DefaultPlugins, brigadier::prelude::CommandDispatcher, prelude::*,
|
||||
@ -55,7 +55,7 @@ struct State {
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
async fn main() -> Result<()> {
|
||||
#[cfg(feature = "console-subscriber")]
|
||||
console_subscriber::init();
|
||||
|
||||
@ -131,8 +131,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
} else {
|
||||
Account::offline(&username)
|
||||
};
|
||||
|
||||
let Err(error) = ClientBuilder::new_without_plugins()
|
||||
let Err(err) = ClientBuilder::new_without_plugins()
|
||||
.add_plugins(DefaultBotPlugins)
|
||||
.add_plugins(HacksPlugin)
|
||||
.add_plugins(default_plugins)
|
||||
@ -145,7 +144,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
})
|
||||
.start(account, server)
|
||||
.await;
|
||||
eprintln!("{error}");
|
||||
eprintln!("{err}");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -3,17 +3,15 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use azalea::{
|
||||
ecs::{event::EventReader, system::Query},
|
||||
ecs::event::EventReader,
|
||||
packet::{
|
||||
config::ReceiveConfigPacketEvent,
|
||||
game::emit_receive_packet_events,
|
||||
login::{LoginPacketEvent, process_packet_events},
|
||||
config::ReceiveConfigPacketEvent, game::ReceiveGamePacketEvent,
|
||||
login::ReceiveLoginPacketEvent,
|
||||
},
|
||||
protocol::packets::login::ClientboundLoginPacket,
|
||||
raw_connection::RawConnection,
|
||||
};
|
||||
use bevy_app::{App, First, Plugin};
|
||||
use bevy_ecs::{schedule::IntoSystemConfigs, system::ResMut};
|
||||
use bevy_ecs::system::ResMut;
|
||||
use log::error;
|
||||
use parking_lot::Mutex;
|
||||
|
||||
@ -28,19 +26,16 @@ impl Plugin for RecordPlugin {
|
||||
let recorder = self.recorder.lock().take();
|
||||
if let Some(recorder) = recorder {
|
||||
app.insert_resource(recorder)
|
||||
.add_systems(First, record_login_packets.before(process_packet_events))
|
||||
.add_systems(First, record_login_packets)
|
||||
.add_systems(First, record_configuration_packets)
|
||||
.add_systems(
|
||||
First,
|
||||
record_game_packets.before(emit_receive_packet_events),
|
||||
);
|
||||
.add_systems(First, record_game_packets);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn record_login_packets(
|
||||
recorder: Option<ResMut<Recorder>>,
|
||||
mut events: EventReader<LoginPacketEvent>,
|
||||
mut events: EventReader<ReceiveLoginPacketEvent>,
|
||||
) {
|
||||
if let Some(mut recorder) = recorder {
|
||||
for event in events.read() {
|
||||
@ -63,20 +58,20 @@ fn record_configuration_packets(
|
||||
) {
|
||||
if let Some(mut recorder) = recorder {
|
||||
for event in events.read() {
|
||||
if let Err(error) = recorder.save_packet(&event.packet) {
|
||||
if let Err(error) = recorder.save_packet(event.packet.as_ref()) {
|
||||
error!("failed to record configuration packet: {error:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn record_game_packets(recorder: Option<ResMut<Recorder>>, query: Query<&RawConnection>) {
|
||||
if let Some(mut recorder) = recorder
|
||||
&& let Ok(raw_conn) = query.get_single()
|
||||
{
|
||||
let queue = raw_conn.incoming_packet_queue();
|
||||
for raw_packet in queue.lock().iter() {
|
||||
if let Err(error) = recorder.save_raw_packet(raw_packet) {
|
||||
fn record_game_packets(
|
||||
recorder: Option<ResMut<Recorder>>,
|
||||
mut events: EventReader<ReceiveGamePacketEvent>,
|
||||
) {
|
||||
if let Some(mut recorder) = recorder {
|
||||
for event in events.read() {
|
||||
if let Err(error) = recorder.save_packet(event.packet.as_ref()) {
|
||||
error!("failed to record game packet: {error:?}");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user