|
| 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 | +} |
0 commit comments