diff --git a/README.md b/README.md index 937753f..a8e71e2 100644 --- a/README.md +++ b/README.md @@ -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` diff --git a/src/main/java/anticope/rejects/mixin/meteor/modules/KillAuraMixin.java b/src/main/java/anticope/rejects/mixin/meteor/modules/KillAuraMixin.java index e39c395..2c58af2 100644 --- a/src/main/java/anticope/rejects/mixin/meteor/modules/KillAuraMixin.java +++ b/src/main/java/anticope/rejects/mixin/meteor/modules/KillAuraMixin.java @@ -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 onlyOnLook; + @Shadow + private int hitTimer; + @Shadow + @Final + private SettingGroup sgTiming; + @Shadow + @Final + private Setting customDelay; + @Shadow + @Final + private Setting hitDelay; + private final Random random = new Random(); private Setting fov; private Setting ignoreInvisible; + private Setting randomTeleport; + private Setting hitChance; + private Setting randomDelayMax; + + public KillAuraMixin(Category category, String name, String description) { + super(category, name, description); + } @Inject(method = "", 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; + } }