Readded KA stuff

This commit is contained in:
ThebestkillerTBK
2023-02-05 21:26:07 +08:00
committed by Cloudburst
parent 64cd713593
commit 060bb68f30
2 changed files with 81 additions and 6 deletions

View File

@@ -88,6 +88,7 @@
- `Duplicate names`
- KillAura
- `Fov and invisible filter`
- `Random Teleport, Hit Chance, Random Delay` (Removed from Meteor in [8722e](https://github.com/MeteorDevelopment/meteor-client/commit/8722ef565afa02ca4b6d9710a20fc9fcfd97bf05))
- AimAssist
- `Fov filter`

View File

@@ -1,12 +1,13 @@
package anticope.rejects.mixin.meteor.modules;
import anticope.rejects.utils.RejectsUtils;
import meteordevelopment.meteorclient.settings.BoolSetting;
import meteordevelopment.meteorclient.settings.DoubleSetting;
import meteordevelopment.meteorclient.settings.Setting;
import meteordevelopment.meteorclient.settings.SettingGroup;
import meteordevelopment.meteorclient.events.world.TickEvent;
import meteordevelopment.meteorclient.settings.*;
import meteordevelopment.meteorclient.systems.modules.Category;
import meteordevelopment.meteorclient.systems.modules.Module;
import meteordevelopment.meteorclient.systems.modules.combat.KillAura;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.Box;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@@ -14,19 +15,43 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import java.util.Random;
@Mixin(value = KillAura.class, remap = false)
public class KillAuraMixin {
public class KillAuraMixin extends Module {
@Shadow
@Final
private SettingGroup sgGeneral;
@Shadow
@Final
private SettingGroup sgTargeting;
@Shadow
@Final
private Setting<Boolean> onlyOnLook;
@Shadow
private int hitTimer;
@Shadow
@Final
private SettingGroup sgTiming;
@Shadow
@Final
private Setting<Boolean> customDelay;
@Shadow
@Final
private Setting<Integer> hitDelay;
private final Random random = new Random();
private Setting<Double> fov;
private Setting<Boolean> ignoreInvisible;
private Setting<Boolean> randomTeleport;
private Setting<Double> hitChance;
private Setting<Integer> randomDelayMax;
public KillAuraMixin(Category category, String name, String description) {
super(category, name, description);
}
@Inject(method = "<init>", at = @At("TAIL"))
private void onInit(CallbackInfo info) {
@@ -45,6 +70,33 @@ public class KillAuraMixin {
.defaultValue(false)
.build()
);
randomTeleport = sgGeneral.add(new BoolSetting.Builder()
.name("random-teleport")
.description("Randomly teleport around the target.")
.defaultValue(false)
.visible(() -> !onlyOnLook.get())
.build()
);
hitChance = sgGeneral.add(new DoubleSetting.Builder()
.name("hit-chance")
.description("The probability of your hits landing.")
.defaultValue(100)
.range(1, 100)
.sliderRange(1, 100)
.build()
);
randomDelayMax = sgTiming.add(new IntSetting.Builder()
.name("random-delay-max")
.description("The maximum value for random delay.")
.defaultValue(4)
.min(0)
.sliderMax(20)
.visible(customDelay::get)
.build()
);
}
@Inject(method = "entityCheck", at = @At(value = "RETURN", ordinal = 14), cancellable = true)
@@ -53,4 +105,26 @@ public class KillAuraMixin {
if (!RejectsUtils.inFov(entity, fov.get())) info.setReturnValue(false);
info.setReturnValue(info.getReturnValueZ());
}
@Inject(method = "attack", at = @At("HEAD"), cancellable = true)
private void onAttack(Entity entity, CallbackInfo info) {
if (hitChance.get() < 100 && Math.random() > hitChance.get() / 100) info.cancel();
}
@Inject(method = "onTick", at = @At("TAIL"), locals = LocalCapture.CAPTURE_FAILSOFT)
private void onTick(TickEvent.Pre event, CallbackInfo info, Entity primary, Box hitbox) {
if (randomTeleport.get() && !onlyOnLook.get()) {
mc.player.setPosition(primary.getX() + randomOffset(), primary.getY(), primary.getZ() + randomOffset());
}
}
@Inject(method = "attack", at = @At(value = "TAIL"))
private void modifyHitDelay(CallbackInfo info) {
if (randomDelayMax.get() == 0) return;
hitTimer -= random.nextInt(randomDelayMax.get());
}
private double randomOffset() {
return Math.random() * 4 - 2;
}
}