refactor: bring azalea-hax crate in-tree
This commit is contained in:
parent
3735a83f57
commit
8494c35d1c
9
Cargo.lock
generated
9
Cargo.lock
generated
@ -593,14 +593,6 @@ dependencies = [
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "azalea-hax"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/azalea-rs/azalea-hax#2af9e0759aded7df01770b717f207b3c1083f942"
|
||||
dependencies = [
|
||||
"azalea",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "azalea-inventory"
|
||||
version = "0.11.0+mc1.21.4"
|
||||
@ -1749,7 +1741,6 @@ version = "0.2.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"azalea",
|
||||
"azalea-hax",
|
||||
"bevy_app",
|
||||
"bevy_ecs",
|
||||
"bevy_log",
|
||||
|
@ -21,7 +21,6 @@ built = { git = "https://github.com/lukaslueg/built", features = ["git2"] }
|
||||
[dependencies]
|
||||
anyhow = "1"
|
||||
azalea = { git = "https://github.com/azalea-rs/azalea" }
|
||||
azalea-hax = { git = "https://github.com/azalea-rs/azalea-hax" }
|
||||
bevy_app = "0"
|
||||
bevy_ecs = "0"
|
||||
bevy_log = "0"
|
||||
|
20
src/hacks/anti_knockback.rs
Normal file
20
src/hacks/anti_knockback.rs
Normal file
@ -0,0 +1,20 @@
|
||||
use azalea::{
|
||||
Vec3,
|
||||
movement::{KnockbackEvent, KnockbackType},
|
||||
prelude::Component,
|
||||
};
|
||||
use bevy_ecs::{event::EventMutator, query::With, system::Query};
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct AntiKnockback;
|
||||
|
||||
pub fn anti_knockback(
|
||||
mut events: EventMutator<KnockbackEvent>,
|
||||
entity_query: Query<(), With<AntiKnockback>>,
|
||||
) {
|
||||
for event in events.read() {
|
||||
if entity_query.get(event.entity).is_ok() {
|
||||
event.knockback = KnockbackType::Add(Vec3::default());
|
||||
}
|
||||
}
|
||||
}
|
21
src/hacks/mod.rs
Normal file
21
src/hacks/mod.rs
Normal file
@ -0,0 +1,21 @@
|
||||
#![allow(clippy::needless_pass_by_value)]
|
||||
|
||||
pub mod anti_knockback;
|
||||
|
||||
use anti_knockback::anti_knockback;
|
||||
use azalea::{movement::handle_knockback, packet_handling::game::process_packet_events};
|
||||
use bevy_app::{App, Plugin, PreUpdate};
|
||||
use bevy_ecs::schedule::IntoSystemConfigs;
|
||||
|
||||
pub struct HacksPlugin;
|
||||
|
||||
impl Plugin for HacksPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_systems(
|
||||
PreUpdate,
|
||||
anti_knockback
|
||||
.after(process_packet_events)
|
||||
.before(handle_knockback),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,3 +1,5 @@
|
||||
use crate::hacks::anti_knockback::AntiKnockback;
|
||||
|
||||
use super::Client;
|
||||
use azalea::{
|
||||
ClientInformation,
|
||||
@ -5,7 +7,6 @@ use azalea::{
|
||||
pathfinder::PathfinderDebugParticles,
|
||||
protocol::common::client_information::ModelCustomization,
|
||||
};
|
||||
use azalea_hax::AntiKnockback;
|
||||
use mlua::{Error, Lua, Result, Table, UserDataRef};
|
||||
|
||||
pub fn air_supply(_lua: &Lua, client: &Client) -> Result<i32> {
|
||||
|
@ -4,6 +4,7 @@ mod arguments;
|
||||
mod build_info;
|
||||
mod commands;
|
||||
mod events;
|
||||
mod hacks;
|
||||
mod http;
|
||||
mod lua;
|
||||
mod particle;
|
||||
@ -17,7 +18,6 @@ use arguments::Arguments;
|
||||
use azalea::{
|
||||
DefaultBotPlugins, DefaultPlugins, brigadier::prelude::CommandDispatcher, prelude::*,
|
||||
};
|
||||
use azalea_hax::HaxPlugin;
|
||||
use bevy_app::PluginGroup;
|
||||
use bevy_log::{
|
||||
LogPlugin,
|
||||
@ -27,6 +27,7 @@ use clap::Parser;
|
||||
use commands::{CommandSource, register};
|
||||
use futures::lock::Mutex;
|
||||
use futures_locks::RwLock;
|
||||
use hacks::HacksPlugin;
|
||||
use log::debug;
|
||||
use mlua::{Function, Lua, Table};
|
||||
use replay::{plugin::RecordPlugin, recorder::Recorder};
|
||||
@ -130,7 +131,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
|
||||
let Err(error) = ClientBuilder::new_without_plugins()
|
||||
.add_plugins(DefaultBotPlugins)
|
||||
.add_plugins(HaxPlugin)
|
||||
.add_plugins(HacksPlugin)
|
||||
.add_plugins(default_plugins)
|
||||
.add_plugins(record_plugin)
|
||||
.set_handler(events::handle_event)
|
||||
|
Loading…
x
Reference in New Issue
Block a user