diff options
author | RoseGoldIsntGay <yoavkau@gmail.com> | 2022-07-27 21:47:43 +0300 |
---|---|---|
committer | RoseGoldIsntGay <yoavkau@gmail.com> | 2022-07-27 21:47:43 +0300 |
commit | 170ccfa42e36f04306820fbc3ef8a8ce3cf75010 (patch) | |
tree | 6728741f9a9befcb71ce1f27262073c984affe9a /src/main/java/rosegoldaddons/features/AutoClicker.java | |
parent | 854c131bf7965cef66d37e80640999242c9e0d65 (diff) | |
download | RGA-170ccfa42e36f04306820fbc3ef8a8ce3cf75010.tar.gz RGA-170ccfa42e36f04306820fbc3ef8a8ce3cf75010.tar.bz2 RGA-170ccfa42e36f04306820fbc3ef8a8ce3cf75010.zip |
imma be real with y'all this is really old changes i never pushed to git so forgive me if the changelog is partial
added an autoclicker that probably gets u banned
added auto leave limbo
added three weirdos auto solver
added block size modifiers for dungeons
i changed a log of stuff probably bug fixes have fun
Diffstat (limited to 'src/main/java/rosegoldaddons/features/AutoClicker.java')
-rw-r--r-- | src/main/java/rosegoldaddons/features/AutoClicker.java | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/src/main/java/rosegoldaddons/features/AutoClicker.java b/src/main/java/rosegoldaddons/features/AutoClicker.java new file mode 100644 index 0000000..0411df3 --- /dev/null +++ b/src/main/java/rosegoldaddons/features/AutoClicker.java @@ -0,0 +1,80 @@ +package rosegoldaddons.features; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.settings.KeyBinding; +import net.minecraft.util.MovingObjectPosition; +import net.minecraftforge.fml.client.registry.ClientRegistry; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.InputEvent; +import org.lwjgl.input.Keyboard; +import rosegoldaddons.Main; +import rosegoldaddons.events.MillisecondEvent; +import rosegoldaddons.utils.ChatUtils; + +import java.lang.reflect.Method; + +public class AutoClicker { + private static final KeyBinding keyBinding = new KeyBinding("Auto Clicker", Keyboard.KEY_NONE, "RoseGoldAddons - Combat"); + private boolean toggled = false; + private int count = 0; + private long startedAt = 0; + private long lastClickTime = 0; + + @SubscribeEvent + public void onMillisecond(MillisecondEvent event) { + if(!toggled) return; + if(System.currentTimeMillis() - lastClickTime < (long) (1000 / Main.configFile.autoClickerCPS)) return; + switch (Main.configFile.autoClickerMode) { + case 1: + MovingObjectPosition movingObjectPosition = Main.mc.objectMouseOver; + if (movingObjectPosition != null && movingObjectPosition.entityHit != null) { + Main.mc.playerController.attackEntity(Main.mc.thePlayer, movingObjectPosition.entityHit); + Main.mc.thePlayer.swingItem(); + count++; + } else if (movingObjectPosition != null) { + Main.mc.thePlayer.swingItem(); + } + break; + case 0: + rightClick(); + count++; + break; + } + lastClickTime = System.currentTimeMillis(); + } + + @SubscribeEvent + public void onKeyInput(InputEvent.KeyInputEvent event) { + int eventKey = Keyboard.getEventKey(); + if(eventKey != keyBinding.getKeyCode()) return; + if(Keyboard.isKeyDown(eventKey)) { + if(!toggled) { + toggled = true; + count = 0; + startedAt = System.currentTimeMillis(); + } + } else { + toggled = false; + ChatUtils.sendMessage(String.format("%s Clicks in %s milliseconds", count, System.currentTimeMillis() - startedAt)); + } + } + + public static void init() { + ClientRegistry.registerKeyBinding(keyBinding); + } + + public static void rightClick() { + try { + Method rightClickMouse; + try { + rightClickMouse = Minecraft.class.getDeclaredMethod("func_147121_ag"); + } catch (NoSuchMethodException e) { + rightClickMouse = Minecraft.class.getDeclaredMethod("rightClickMouse"); + } + rightClickMouse.setAccessible(true); + rightClickMouse.invoke(Main.mc); + } catch (Exception e) { + e.printStackTrace(); + } + } +} |