feat: add proper nix flake
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use azalea::{brigadier::prelude::*, client_chat::ChatPacket, prelude::*};
|
||||
use azalea::{brigadier::prelude::*, chat::ChatPacket, prelude::*};
|
||||
use futures::lock::Mutex;
|
||||
use mlua::{Error, Result, Table, UserDataRef};
|
||||
use ncr::{
|
||||
|
||||
19
src/hacks/anti_knockback.rs
Normal file
19
src/hacks/anti_knockback.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
use azalea::{
|
||||
entity::Physics,
|
||||
movement::{KnockbackEvent, handle_knockback},
|
||||
prelude::*,
|
||||
};
|
||||
use bevy_ecs::{observer::On, query::With, system::Query};
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct AntiKnockback;
|
||||
|
||||
pub fn anti_knockback(
|
||||
knockback: On<KnockbackEvent>,
|
||||
entity_query: Query<(), With<AntiKnockback>>,
|
||||
handle_knockback_query: Query<&mut Physics>,
|
||||
) {
|
||||
if entity_query.get(knockback.entity).is_err() {
|
||||
handle_knockback(knockback, handle_knockback_query);
|
||||
}
|
||||
}
|
||||
28
src/hacks/mod.rs
Normal file
28
src/hacks/mod.rs
Normal file
@@ -0,0 +1,28 @@
|
||||
pub mod anti_knockback;
|
||||
|
||||
use azalea::movement::KnockbackEvent;
|
||||
use bevy_app::{App, Plugin, PostStartup};
|
||||
use bevy_ecs::world::World;
|
||||
|
||||
pub struct HacksPlugin;
|
||||
|
||||
impl Plugin for HacksPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_systems(PostStartup, init_hacks);
|
||||
}
|
||||
}
|
||||
|
||||
fn init_hacks(ecs: &mut World) {
|
||||
let observers = ecs
|
||||
.observers()
|
||||
.try_get_observers(ecs.event_key::<KnockbackEvent>().unwrap());
|
||||
let mut to_despawn = Vec::new();
|
||||
for (observer_entity, _) in observers.unwrap().global_observers() {
|
||||
to_despawn.push(*observer_entity);
|
||||
}
|
||||
for observer_entity in to_despawn {
|
||||
ecs.despawn(observer_entity);
|
||||
}
|
||||
|
||||
ecs.add_observer(anti_knockback::anti_knockback);
|
||||
}
|
||||
@@ -2,11 +2,10 @@ use azalea::{
|
||||
ClientInformation, entity::metadata::AirSupply, pathfinder::debug::PathfinderDebugParticles,
|
||||
protocol::common::client_information::ModelCustomization,
|
||||
};
|
||||
use azalea_hax::AntiKnockback;
|
||||
use mlua::{Error, Lua, Result, Table, UserDataRef};
|
||||
|
||||
use super::Client;
|
||||
use crate::unpack;
|
||||
use crate::{hacks::anti_knockback::AntiKnockback, unpack};
|
||||
|
||||
pub fn air_supply(_lua: &Lua, client: &Client) -> Result<i32> {
|
||||
Ok(client.component::<AirSupply>().0)
|
||||
|
||||
@@ -5,6 +5,7 @@ mod arguments;
|
||||
mod build_info;
|
||||
mod commands;
|
||||
mod events;
|
||||
mod hacks;
|
||||
mod http;
|
||||
mod lua;
|
||||
mod particle;
|
||||
@@ -27,7 +28,6 @@ use arguments::Arguments;
|
||||
use azalea::{
|
||||
DefaultPlugins, bot::DefaultBotPlugins, brigadier::prelude::CommandDispatcher, prelude::*,
|
||||
};
|
||||
use azalea_hax::HaxPlugin;
|
||||
use bevy_app::PluginGroup;
|
||||
use bevy_log::{
|
||||
LogPlugin,
|
||||
@@ -45,6 +45,8 @@ use {
|
||||
replay::{plugin::RecordPlugin, recorder::Recorder},
|
||||
};
|
||||
|
||||
use crate::hacks::HacksPlugin;
|
||||
|
||||
#[cfg(feature = "mimalloc")]
|
||||
#[global_allocator]
|
||||
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
||||
@@ -114,7 +116,7 @@ async fn main() -> Result<()> {
|
||||
let builder = ClientBuilder::new_without_plugins()
|
||||
.add_plugins(default_plugins)
|
||||
.add_plugins(DefaultBotPlugins)
|
||||
.add_plugins(HaxPlugin);
|
||||
.add_plugins(HacksPlugin);
|
||||
|
||||
#[cfg(feature = "replay")]
|
||||
let builder = builder.add_plugins(RecordPlugin {
|
||||
|
||||
Reference in New Issue
Block a user