1
0
Fork 0
mirror of https://github.com/azalea-rs/azalea-hax.git synced 2025-08-02 14:26:05 +00:00

update deps and remove unsafe now that bevy EventMutator exists

This commit is contained in:
mat 2025-02-22 23:09:30 +00:00
parent 5026040bf4
commit 2af9e0759a
3 changed files with 1340 additions and 873 deletions

2200
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
[package] [package]
name = "azalea-hax" name = "azalea-hax"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2024"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -48,17 +48,10 @@ impl HaxClientExt for azalea::Client {
pub struct AntiKnockback; pub struct AntiKnockback;
fn anti_knockback( fn anti_knockback(
mut events: EventReader<KnockbackEvent>, mut events: EventMutator<KnockbackEvent>,
entity_query: Query<(), With<AntiKnockback>>, entity_query: Query<(), With<AntiKnockback>>,
) { ) {
// bevy please merge this https://github.com/bevyengine/bevy/pull/8051 for event in events.read() {
// :pleading:
#[allow(invalid_reference_casting)]
for event in events
.read()
// shhh you didn't see anything
.map(|e| unsafe { &mut *(e as *const KnockbackEvent as *mut KnockbackEvent) })
{
if entity_query.get(event.entity).is_ok() { if entity_query.get(event.entity).is_ok() {
event.knockback = KnockbackType::Add(Vec3::default()); event.knockback = KnockbackType::Add(Vec3::default());
} }