This repository has been archived by the owner on May 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
💓 Fix ClickAssist ++ WTAP (buggyish)
- Loading branch information
Showing
3 changed files
with
133 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 67 additions & 38 deletions
105
src/main/java/dev/stormy/client/module/modules/combat/ClickAssist.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,111 @@ | ||
package dev.stormy.client.module.modules.combat; | ||
|
||
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.game.MouseManager; | ||
import dev.stormy.client.module.setting.impl.*; | ||
import dev.stormy.client.utils.math.MathUtils; | ||
import dev.stormy.client.utils.math.TimerUtils; | ||
import dev.stormy.client.utils.player.PlayerUtils; | ||
import me.tryfle.stormy.events.UpdateEvent; | ||
import net.minecraft.util.ChatComponentText; | ||
import net.weavemc.loader.api.event.SubscribeEvent; | ||
import net.weavemc.loader.api.event.MouseEvent; | ||
|
||
import java.awt.*; | ||
|
||
//note to self: make this work | ||
@SuppressWarnings("unused") | ||
public class ClickAssist extends Module { | ||
|
||
TimerUtils timer = new TimerUtils(); | ||
public static SliderSetting chance; | ||
public static TickSetting cpsCheck; | ||
public static DoubleSliderSetting cd; | ||
public static ComboSetting<modes> mode; | ||
private boolean allowClick = false; | ||
public Robot robot; | ||
private int cps; | ||
|
||
|
||
public ClickAssist() { | ||
super("ClickAssist", ModuleCategory.Combat, 0); | ||
this.registerSetting(new DescriptionSetting("Chance to double click.")); | ||
this.registerSetting(new DescriptionSetting("locked at 100%, don't use.")); | ||
this.registerSetting(chance = new SliderSetting("Chance", 50.0D, 0.0D, 100.0D, 1.0D)); | ||
this.registerSetting(cd = new DoubleSliderSetting("Delay", 40, 100, 0, 300, 1)); | ||
this.registerSetting(cpsCheck = new TickSetting("Only if above 5 CPS", true)); | ||
this.registerSetting(mode = new ComboSetting<>("Mode", modes.LMB)); | ||
} | ||
|
||
public void onEnable() { | ||
try { | ||
this.robot = new Robot(); | ||
} catch (AWTException awtexc) { | ||
mc.thePlayer.addChatMessage(new ChatComponentText("An error has occurred and ClickAssist had to be disabled. Stacktrace printed to console.")); | ||
awtexc.printStackTrace(); | ||
} catch (AWTException ex) { | ||
mc.thePlayer.addChatMessage(new ChatComponentText("An error has occurred: Stacktrace printed to console.")); | ||
ex.printStackTrace(); | ||
this.disable(); | ||
} | ||
} | ||
|
||
@SuppressWarnings("unused") | ||
public int getButton() { | ||
if (mode.getMode() == modes.LMB) { | ||
return 16; | ||
} else { | ||
return 4; | ||
} | ||
} | ||
public int getButton2() { | ||
if (mode.getMode() == modes.LMB) { | ||
return 0; | ||
} else { | ||
return 1; | ||
} | ||
} | ||
|
||
@SubscribeEvent | ||
public void whyClick(MouseEvent e) { | ||
if (PlayerUtils.isPlayerInGame()) { | ||
if (cpsCheck.isToggled()) { | ||
if (e.getButtonState() && e.getButton() == 0 && chance.getInput() == 100.0D && MouseManager.getLeftClickCounter() >= 5) { | ||
logic(); | ||
} | ||
if (e.getButtonState() && e.getButton() == 0 && chance.getInput() != 100.0D) { | ||
double ch = Math.random(); | ||
if (ch >= chance.getInput() / 100.0D) { | ||
logic(); | ||
} | ||
} | ||
} else { | ||
if (e.getButtonState() && e.getButton() == 0 && chance.getInput() == 100.0D) { | ||
logic(); | ||
} | ||
if (e.getButtonState() && e.getButton() == 0 && chance.getInput() != 100.0D) { | ||
double ch = Math.random(); | ||
if (ch >= chance.getInput() / 100.0D) { | ||
logic(); | ||
} | ||
public void onClick(MouseEvent e) { | ||
if (!PlayerUtils.isPlayerInGame()) return; | ||
if (e.getButton() == getButton2()) { | ||
cps++; | ||
if (allowClick) { | ||
double ch = Math.random() * 100; | ||
if (ch >= chance.getInput()) { | ||
return; | ||
} | ||
} | ||
if (cpsCheck.isToggled() && cps < 5) { | ||
return; | ||
} | ||
int d = MathUtils.randomInt(cd.getInputMin(), cd.getInputMax()); | ||
if (timer.hasReached(d)) { | ||
logic(); | ||
timer.reset(); | ||
} | ||
} | ||
} | ||
|
||
@SubscribeEvent | ||
public void onUpdate(UpdateEvent e) { | ||
if (timer.hasReached(1000) && cps > 0) { | ||
cps = 0; | ||
timer.reset(); | ||
} | ||
} | ||
|
||
public void logic() { | ||
if (allowClick) { | ||
this.robot.mouseRelease(16); | ||
this.robot.mousePress(16); | ||
this.robot.mouseRelease(16); | ||
this.robot.mouseRelease(getButton()); | ||
this.robot.mousePress(getButton()); | ||
this.robot.mouseRelease(getButton()); | ||
allowClick = false; | ||
} else { | ||
allowClick = true; | ||
} | ||
} | ||
public void onDisable() { | ||
this.robot = null; | ||
} | ||
} | ||
|
||
public void onDisable() { | ||
cps = 0; | ||
this.robot = null; | ||
} | ||
|
||
public enum modes { | ||
LMB, RMB | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
src/main/java/dev/stormy/client/module/modules/combat/WTap.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package dev.stormy.client.module.modules.combat; | ||
|
||
import dev.stormy.client.module.Module; | ||
import dev.stormy.client.module.setting.impl.DescriptionSetting; | ||
import dev.stormy.client.module.setting.impl.DoubleSliderSetting; | ||
import dev.stormy.client.module.setting.impl.SliderSetting; | ||
import dev.stormy.client.utils.math.MathUtils; | ||
import dev.stormy.client.utils.math.TimerUtils; | ||
import dev.stormy.client.utils.player.PlayerUtils; | ||
import me.tryfle.stormy.events.UpdateEvent; | ||
import net.minecraft.client.settings.KeyBinding; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.util.MovingObjectPosition; | ||
import net.weavemc.loader.api.event.SubscribeEvent; | ||
import org.lwjgl.input.Mouse; | ||
|
||
@SuppressWarnings("unused") | ||
public class WTap extends Module { | ||
public static SliderSetting range, chance; | ||
public static DoubleSliderSetting delay; | ||
TimerUtils timer = new TimerUtils(); | ||
|
||
public WTap() { | ||
super("WTap", Module.ModuleCategory.Combat, 0); | ||
this.registerSetting(new DescriptionSetting("Sprint resets automatically.")); | ||
this.registerSetting(range = new SliderSetting("Range", 4.0D, 0.0D, 6.0D, 0.1D)); | ||
this.registerSetting(chance = new SliderSetting("Chance", 50.0D, 0.0D, 100.0D, 1.0D)); | ||
this.registerSetting(delay = new DoubleSliderSetting("Delay", 50.0D, 100.0D, 0.0D, 300.0D, 5.0D)); | ||
} | ||
|
||
int wkey = mc.gameSettings.keyBindForward.getKeyCode(); | ||
|
||
public boolean isLookingAtPlayer() { | ||
MovingObjectPosition result = mc.objectMouseOver; | ||
if (result != null && result.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && result.entityHit instanceof EntityPlayer targetPlayer) { | ||
return PlayerUtils.lookingAtPlayer(mc.thePlayer, targetPlayer, range.getInput()); | ||
} | ||
return false; | ||
} | ||
|
||
@SubscribeEvent | ||
public void onUpdate(UpdateEvent e) { | ||
if (PlayerUtils.isPlayerInGame() && isLookingAtPlayer() && Mouse.isButtonDown(0) && mc.thePlayer.moveForward > 0 && mc.currentScreen == null) { | ||
if (chance.getInput() != 100.0D) { | ||
double ch = Math.random() * 100; | ||
if (ch >= chance.getInput()) { | ||
return; | ||
} | ||
} | ||
int d = MathUtils.randomInt(delay.getInputMin(), delay.getInputMax()); | ||
if (timer.hasReached(d)) { | ||
KeyBinding.setKeyBindState(wkey, false); | ||
KeyBinding.onTick(wkey); | ||
rePress(); | ||
} | ||
} | ||
} | ||
|
||
public void rePress() { | ||
if (mc.thePlayer.moveForward > 0) { | ||
KeyBinding.setKeyBindState(wkey, true); | ||
KeyBinding.onTick(wkey); | ||
} | ||
} | ||
} |