Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
❤️ Hitselect, Killaura w/ rots, etc.
Browse files Browse the repository at this point in the history
ETC: sprint with no slow is now proper and not mc.thePlayer.setSprinting() oh and a couple utils that i added for something that i ended up not implementing, they might be useful later i guess
  • Loading branch information
Tryflle committed Nov 19, 2023
1 parent 2f9dc32 commit bffd7c3
Show file tree
Hide file tree
Showing 7 changed files with 185 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@
import dev.stormy.client.utils.Utils;
import net.minecraft.block.BlockLiquid;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.weavemc.loader.api.event.EventBus;
import net.weavemc.loader.api.event.MouseEvent;
import net.weavemc.loader.api.event.RenderHandEvent;
import net.weavemc.loader.api.event.SubscribeEvent;
import org.lwjgl.input.Mouse;
import net.minecraft.util.MovingObjectPosition;


@SuppressWarnings("unused")
public class AutoClicker extends Module {
public static TickSetting breakBlocks;
public static TickSetting breakBlocks, hitSelect;
public static SliderSetting leftCPS;
public boolean shouldClick, breakHeld = false;
long lastClickTime = 0;
Expand All @@ -30,6 +33,7 @@ public AutoClicker() {
this.registerSetting(new DescriptionSetting("Click automatically"));
this.registerSetting(leftCPS = new SliderSetting("CPS", 10.0D, 1.0D, 20.0D, 1.0D));
this.registerSetting(breakBlocks = new TickSetting("Break blocks", false));
this.registerSetting(hitSelect = new TickSetting("Hit Select", false));
}

public boolean breakBlock() {
Expand All @@ -46,19 +50,27 @@ public boolean breakBlock() {
}
return true;
}
if(breakHeld) {
if (breakHeld) {
breakHeld = false;
}
}
}
return false;
}

public boolean hitSelectLogic() {
if (!hitSelect.isToggled()) return false;
MovingObjectPosition result = mc.objectMouseOver;
if (result != null && result.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && result.entityHit instanceof EntityPlayer targetPlayer) {
return hitSelect.isToggled() && Utils.Player.lookingAtPlayer(mc.thePlayer, targetPlayer, 3.5);
}
return false;
}
@SubscribeEvent
public void bop(RenderHandEvent e) {
randomizer();

if (Utils.Player.isPlayerInGame() && Mouse.isButtonDown(0) && shouldClick && mc.currentScreen == null) {
if (hitSelect.isToggled() && !hitSelectLogic()) return;
if (breakBlock()) return;
long currentTime = System.currentTimeMillis();
int delay = 1000 / (int) leftCPS.getInput() + Utils.Java.randomInt(-3, 3);
Expand Down
134 changes: 108 additions & 26 deletions src/main/java/dev/stormy/client/module/modules/combat/Killaura.java
Original file line number Diff line number Diff line change
@@ -1,56 +1,138 @@
package dev.stormy.client.module.modules.combat;

import dev.stormy.client.clickgui.Theme;
import dev.stormy.client.module.Module;
import dev.stormy.client.module.setting.impl.DescriptionSetting;
import dev.stormy.client.module.setting.impl.SliderSetting;
import dev.stormy.client.module.setting.impl.TickSetting;
import dev.stormy.client.utils.TimerUtils;
import dev.stormy.client.utils.Utils;
import net.minecraft.client.Minecraft;
import me.tryfle.stormy.events.UpdateEvent;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.play.client.C02PacketUseEntity;
import net.minecraft.util.Vec3;
import net.weavemc.loader.api.event.EventBus;
import net.weavemc.loader.api.event.MouseEvent;
import net.weavemc.loader.api.event.SubscribeEvent;
import net.weavemc.loader.api.event.TickEvent;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.weavemc.loader.api.event.*;
import org.lwjgl.input.Mouse;

import java.util.Optional;
import static java.lang.Math.PI;

@SuppressWarnings("unused")
public class Killaura extends Module {
static Optional<EntityPlayer> target = Optional.empty();
public static SliderSetting range, delay;
public static SliderSetting range, frequency, hurtTimeAmt, rotRand;
public static TickSetting shouldBlock, targetESP, testSetting, alwaysAB, rots;
public TimerUtils timer = new TimerUtils();
public boolean delaying, isAttacking = false;
long lastClickTime = 0;
int rmb = mc.gameSettings.keyBindUseItem.getKeyCode();

public Killaura() {
super("Killaura", ModuleCategory.Combat, 0);
this.registerSetting(new DescriptionSetting("NO ROTS. NO BYPASS."));
this.registerSetting(new DescriptionSetting("Probably doesn't bypass much."));
this.registerSetting(range = new SliderSetting("Range", 3, 3, 6, 0.1));
this.registerSetting(delay = new SliderSetting("Frequency", 3, 1, 10, 0.5));
}

public float getRotationYawForTarget(Vec3 pos, Vec3 target) {
double deltaX = target.xCoord - pos.xCoord;
double deltaZ = target.zCoord - pos.zCoord;
double yaw = (Math.atan2(deltaZ, deltaX) * (180 / PI)) - 90;
return (float) yaw;
this.registerSetting(frequency = new SliderSetting("CPS", 10, 1, 20, 0.5));
this.registerSetting(hurtTimeAmt = new SliderSetting("Ignore before hurt time", 0, 0, 20, 1));
this.registerSetting(rotRand = new SliderSetting("Rotation Randomization", 2, 0, 3, .01));
this.registerSetting(rots = new TickSetting("Rotations (for bypassing)", false));
this.registerSetting(shouldBlock = new TickSetting("Autoblock (Hold RMB)", false));
this.registerSetting(alwaysAB = new TickSetting("Autoblock", false));
this.registerSetting(targetESP = new TickSetting("ESP", false));
}


@SubscribeEvent
public void setTarget(TickEvent.Pre e) {
if (Utils.Player.isPlayerInGame()) {
target = mc.theWorld != null
? mc.theWorld.playerEntities.stream()
.filter(player -> player.getEntityId() != mc.thePlayer.getEntityId() &&
player.getDistanceToEntity(Minecraft.getMinecraft().thePlayer) <= range.getInput())
player.getDistanceToEntity(mc.thePlayer) <= range.getInput())
.findFirst() : Optional.empty();
}
}

public boolean aBooleanCheck() {
if (!rots.isToggled()) return false;
MovingObjectPosition result = mc.objectMouseOver;
if (result != null && result.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && result.entityHit instanceof EntityPlayer targetPlayer) {
return rots.isToggled() && Utils.Player.lookingAtPlayer(mc.thePlayer, targetPlayer, range.getInput());
}
return false;
}
@SubscribeEvent
public void experiMental(UpdateEvent.Pre e) {
if (target.isEmpty() || !Utils.Player.isPlayerInGame()) {
isAttacking = false;
return;
}
if (timer.hasReached(1000 / frequency.getInput() + Utils.Java.randomInt(-3, 3)) && mc.thePlayer.hurtTime < hurtTimeAmt.getInput() && mc.currentScreen == null) {
if (target.isPresent()) {
if (mc.thePlayer.isBlocking() || mc.thePlayer.isEating()) return;
if (rots.isToggled() && !aBooleanCheck()) return;
mc.thePlayer.swingItem();
mc.playerController.attackEntity(mc.thePlayer, target.get());
timer.reset();
isAttacking = true;
}
}
}
public void finishDelay() {
long currentTime = System.currentTimeMillis();
int newdelay = Utils.Java.randomInt(20, 70);
if (currentTime - lastClickTime >= newdelay) {
lastClickTime = currentTime;
KeyBinding.setKeyBindState(rmb, false);
KeyBinding.onTick(rmb);
delaying = false;
}
}
@SubscribeEvent
public void onRender(RenderHandEvent e) {
if (((Mouse.isButtonDown(1) && shouldBlock.isToggled()) || alwaysAB.isToggled()) && Utils.Player.isPlayerHoldingWeapon() && isAttacking && mc.currentScreen == null) {
long currentTime = System.currentTimeMillis();
int delay = 1000 / (int) frequency.getInput() + Utils.Java.randomInt(-3, 3) - 4;
if (currentTime - lastClickTime >= delay && !delaying) {
lastClickTime = currentTime;
KeyBinding.setKeyBindState(rmb, true);
KeyBinding.onTick(rmb);
delaying = true;
}
if (delaying) {
finishDelay();
}
}
}
@SubscribeEvent
public void ESP(RenderWorldEvent e) {
if (targetESP.isToggled() && target.isPresent()) {
Utils.HUD.drawBoxAroundEntity(target.get(), 1, 0.0D, 0.0D, Theme.getMainColor().getRGB(), true);
Utils.HUD.drawBoxAroundEntity(target.get(), 2, 0.0D, 0.0D, Theme.getMainColor().getRGB(), true);
}
}
@SubscribeEvent
public void unblockthings(TickEvent e) {
if (!Utils.Player.isPlayerInGame()) return;
if (mc.thePlayer.isBlocking() && Utils.Player.isPlayerHoldingWeapon() && !Mouse.isButtonDown(1) && mc.currentScreen == null && !isAttacking) {
long neow = System.currentTimeMillis();
int ubdelay = Utils.Java.randomInt(850, 1050);
if (neow >= ubdelay) {
KeyBinding.setKeyBindState(rmb, false);
KeyBinding.onTick(rmb);
}
}
}
@SubscribeEvent
public void someMethod(TickEvent.Post e) {
if (Utils.Player.isPlayerInGame() && target.isPresent() && target.get().hurtTime <= delay.getInput()) {
Minecraft.getMinecraft().thePlayer.swingItem();
mc.getNetHandler().addToSendQueue(new C02PacketUseEntity(target.get(), C02PacketUseEntity.Action.ATTACK));
EventBus.callEvent(new MouseEvent());
public void onClientTick(TickEvent.Post e) {
if (Utils.Player.isPlayerInGame() && target.isPresent() && mc.currentScreen == null && rots.isToggled() && !mc.thePlayer.isEating()) {
double deltaX = target.get().posX - mc.thePlayer.posX;
double deltaY = target.get().posY + target.get().getEyeHeight() - mc.thePlayer.posY - mc.thePlayer.getEyeHeight();
double deltaZ = target.get().posZ - mc.thePlayer.posZ;
double distance = MathHelper.sqrt_double(deltaX * deltaX + deltaZ * deltaZ);

float yaw = (float) (Math.atan2(deltaZ, deltaX) * (180 / Math.PI)) - 90.0F + (float) Utils.Java.randomInt(-rotRand.getInput(), rotRand.getInput());
float pitch = (float) (-(Math.atan2(deltaY, distance) * (180 / Math.PI))) + (float) Utils.Java.randomInt(-rotRand.getInput(), rotRand.getInput());

mc.thePlayer.rotationYaw = yaw;
mc.thePlayer.rotationPitch = pitch;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,29 @@
import dev.stormy.client.module.setting.impl.DescriptionSetting;
import dev.stormy.client.module.setting.impl.SliderSetting;
import dev.stormy.client.module.setting.impl.TickSetting;
import dev.stormy.client.utils.TimerUtils;
import dev.stormy.client.utils.Utils;
import me.tryfle.stormy.events.SlowdownEvent;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemPotion;
import net.weavemc.loader.api.event.SubscribeEvent;
import dev.stormy.client.module.Module;
import net.weavemc.loader.api.event.TickEvent;

public class NoSlow extends Module {
public static SliderSetting speed;
public static TickSetting autosprint, noweapons, noconsumables;
public TimerUtils timer = new TimerUtils();
int rmb = mc.gameSettings.keyBindUseItem.getKeyCode();
int sprint = mc.gameSettings.keyBindSprint.getKeyCode();
public boolean shouldFinishBlock = false;

public NoSlow() {
super("NoSlow", ModuleCategory.Movement, 0);
this.registerSetting(new DescriptionSetting("Default is 80% slow."));
this.registerSetting(speed = new SliderSetting("Slow %", 80.0D, 0.0D, 80.0D, 1.0D));
this.registerSetting(autosprint = new TickSetting("Sprint", false));
this.registerSetting(autosprint = new TickSetting("Allow Sprint", false));
this.registerSetting(noweapons = new TickSetting("Blacklist Weapons", false));
this.registerSetting(noconsumables = new TickSetting("Blacklist Consumables", false));
}
Expand All @@ -31,10 +38,26 @@ public void onSlowdown(SlowdownEvent e) {
e.setCancelled(true);
mc.thePlayer.movementInput.moveForward *= (100.0F - (float) speed.getInput()) / 100.0F;
mc.thePlayer.movementInput.moveStrafe *= (100.0F - (float) speed.getInput()) / 100.0F;
if (autosprint.isToggled()) {
mc.thePlayer.setSprinting(true);
if (autosprint.isToggled() && mc.gameSettings.keyBindSprint.isKeyDown() && !mc.thePlayer.isSprinting() && Utils.Player.isPlayerMoving()) {
KeyBinding.setKeyBindState(rmb, false);
KeyBinding.onTick(rmb);
if (timer.hasReached(100 + Utils.Java.randomInt(-10, 10))) {
shouldFinishBlock = true;
KeyBinding.setKeyBindState(sprint, true);
KeyBinding.onTick(sprint);
timer.reset();
}
}
}
@SubscribeEvent
public void reBlock(TickEvent e) {
if (shouldFinishBlock && timer.hasReached(100 + Utils.Java.randomInt(-10, 10))) {
shouldFinishBlock = false;
KeyBinding.setKeyBindState(rmb, true);
KeyBinding.onTick(rmb);
timer.reset();
}
}
public static boolean consumableCheck() {
if (mc.thePlayer.getHeldItem() != null) {
return noconsumables.isToggled() && (mc.thePlayer.getHeldItem().getItem() instanceof ItemFood || mc.thePlayer.getHeldItem().getItem() instanceof ItemPotion);
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/dev/stormy/client/utils/TimerSpeedHelper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package dev.stormy.client.utils;

import me.tryfle.stormy.mixins.IMixinMinecraft;
import net.minecraft.client.Minecraft;

public class TimerSpeedHelper {
public static float getTimerSpeed() {
Minecraft mc = Minecraft.getMinecraft();
return ((IMixinMinecraft) mc).getTimer().timerSpeed;
}
}
11 changes: 11 additions & 0 deletions src/main/java/dev/stormy/client/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ public static boolean isPlayerInGame() {
return mc.thePlayer != null && mc.theWorld != null;
}

public static boolean isPlayerMoving() {
return mc.thePlayer.moveForward != 0.0F || mc.thePlayer.moveStrafing != 0.0F;
}

public static double fovFromEntity(Entity en) {
return ((double) (mc.thePlayer.rotationYaw - fovToEntity(en)) % 360.0D + 540.0D) % 360.0D - 180.0D;
}
Expand All @@ -59,6 +63,13 @@ public static float fovToEntity(Entity ent) {
return (float) (yaw * -1.0D);
}

public static boolean lookingAtPlayer(EntityPlayer viewer, EntityPlayer targetPlayer, double maxDistance) {
double deltaX = targetPlayer.posX - viewer.posX;
double deltaY = targetPlayer.posY - viewer.posY + viewer.getEyeHeight();
double deltaZ = targetPlayer.posZ - viewer.posZ;
double distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ);
return distance < maxDistance;
}
public static boolean playerOverAir() {
double x = mc.thePlayer.posX;
double y = mc.thePlayer.posY - 1.0D;
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/me/tryfle/stormy/mixins/IMixinMinecraft.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package me.tryfle.stormy.mixins;

import net.minecraft.client.Minecraft;
import net.minecraft.util.Timer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;

@Mixin(Minecraft.class)
public interface IMixinMinecraft {
@Accessor("timer")
Timer getTimer();
}
3 changes: 2 additions & 1 deletion src/main/resources/stormy.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"MixinEntityPlayerSP",
"NetworkManagerMixin",
"RendererLivingEntityMixin",
"RenderGlobalMixin"
"RenderGlobalMixin",
"IMixinMinecraft"
]
}

0 comments on commit bffd7c3

Please sign in to comment.