Skip to content

Commit e7f1f3b

Browse files
committed
Add mixins for ElytraFlyPlusPlus
1 parent 5a2e8f9 commit e7f1f3b

3 files changed

Lines changed: 98 additions & 0 deletions

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package dev.journey.PathSeeker.mixin;
2+
3+
import dev.journey.PathSeeker.modules.utility.ElytraFlyPlusPlus;
4+
import meteordevelopment.meteorclient.systems.modules.Modules;
5+
import net.minecraft.entity.Entity;
6+
import net.minecraft.entity.EntityPose;
7+
import org.spongepowered.asm.mixin.Mixin;
8+
import org.spongepowered.asm.mixin.Shadow;
9+
import org.spongepowered.asm.mixin.injection.At;
10+
import org.spongepowered.asm.mixin.injection.Inject;
11+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
12+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
13+
14+
import java.util.UUID;
15+
16+
import static meteordevelopment.meteorclient.MeteorClient.mc;
17+
18+
@Mixin(Entity.class)
19+
public class EntityMixin
20+
{
21+
@Shadow
22+
protected UUID uuid;
23+
24+
ElytraFlyPlusPlus efly = Modules.get().get(ElytraFlyPlusPlus.class);
25+
26+
@Inject(at = @At("HEAD"), method = "Lnet/minecraft/entity/Entity;getPose()Lnet/minecraft/entity/EntityPose;", cancellable = true)
27+
private void getPose(CallbackInfoReturnable<EntityPose> cir)
28+
{
29+
if (efly != null && efly.enabled() && this.uuid == mc.player.getUuid())
30+
{
31+
cir.setReturnValue(EntityPose.STANDING);
32+
}
33+
}
34+
35+
@Inject(at = @At("HEAD"), method = "Lnet/minecraft/entity/Entity;isSprinting()Z", cancellable = true)
36+
private void isSprinting(CallbackInfoReturnable<Boolean> cir)
37+
{
38+
if (efly != null && efly.enabled() && this.uuid == mc.player.getUuid())
39+
{
40+
cir.setReturnValue(true);
41+
}
42+
}
43+
44+
@Inject(at = @At("HEAD"), method = "pushAwayFrom", cancellable = true)
45+
private void pushAwayFrom(Entity entity, CallbackInfo ci)
46+
{
47+
if (mc.player != null && this.uuid == mc.player.getUuid() && efly != null && efly.enabled() && !entity.getUuid().equals(this.uuid))
48+
{
49+
ci.cancel();
50+
}
51+
}
52+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package dev.journey.PathSeeker.mixin;
2+
3+
import dev.journey.PathSeeker.modules.utility.ElytraFlyPlusPlus;
4+
import meteordevelopment.meteorclient.systems.modules.Modules;
5+
import net.minecraft.entity.LivingEntity;
6+
import net.minecraft.entity.ai.brain.Brain;
7+
import org.spongepowered.asm.mixin.Mixin;
8+
import org.spongepowered.asm.mixin.Shadow;
9+
import org.spongepowered.asm.mixin.injection.At;
10+
import org.spongepowered.asm.mixin.injection.Inject;
11+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
12+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
13+
14+
import static meteordevelopment.meteorclient.MeteorClient.mc;
15+
16+
@Mixin(LivingEntity.class)
17+
public abstract class LivingEntityMixin
18+
{
19+
@Shadow
20+
private int jumpingCooldown;
21+
22+
@Shadow
23+
public abstract Brain<?> getBrain();
24+
25+
ElytraFlyPlusPlus efly = Modules.get().get(ElytraFlyPlusPlus.class);
26+
27+
@Inject(at = @At("HEAD"), method = "Lnet/minecraft/entity/LivingEntity;tickMovement()V")
28+
private void tickMovement(CallbackInfo ci)
29+
{
30+
if (mc.player != null && mc.player.getBrain().equals(this.getBrain()) && efly != null && efly.enabled())
31+
{
32+
this.jumpingCooldown = 0;
33+
}
34+
}
35+
36+
@Inject(at = @At("HEAD"), method = "Lnet/minecraft/entity/LivingEntity;isFallFlying()Z", cancellable = true)
37+
private void isFallFlying(CallbackInfoReturnable<Boolean> cir)
38+
{
39+
if (mc.player != null && mc.player.getBrain().equals(this.getBrain()) && efly != null && efly.enabled())
40+
{
41+
cir.setReturnValue(true);
42+
}
43+
}
44+
}

src/main/resources/pathseeker.mixins.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
"defaultRequire": 1
1010
},
1111
"mixins": [
12+
"EntityMixin",
13+
"LivingEntityMixin",
1214
"PlayerEntityMixin",
1315
"accessor.ClientConnectionAccessor"
1416
]

0 commit comments

Comments
 (0)