diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/misc/AutoFish.java b/src/main/java/me/zeroeightsix/kami/module/modules/misc/AutoFish.java index 360a69c4..f1baea72 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/misc/AutoFish.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/misc/AutoFish.java @@ -2,15 +2,25 @@ package me.zeroeightsix.kami.module.modules.misc; import me.zero.alpine.listener.EventHandler; import me.zero.alpine.listener.Listener; +import me.zeroeightsix.kami.command.Command; import me.zeroeightsix.kami.event.events.PacketEvent; import me.zeroeightsix.kami.module.Module; +import me.zeroeightsix.kami.setting.Setting; +import me.zeroeightsix.kami.setting.Settings; import net.minecraft.network.play.server.SPacketSoundEffect; +import java.util.Random; + /** * Created by 086 on 22/03/2018. + * Updated by Qther on 04/03/20 + * Updated by S-B99 on 04/03/20 */ @Module.Info(name = "AutoFish", category = Module.Category.MISC, description = "Automatically catch fish") public class AutoFish extends Module { + private Setting baseDelay = register(Settings.integerBuilder("Throw Delay (ms)").withValue(100).withMinimum(50).withMaximum(1000)); + private Setting extraDelay = register(Settings.integerBuilder("Catch Delay (ms)").withValue(300).withMinimum(0).withMaximum(1000)); + private Setting variation = register(Settings.integerBuilder("Variation (ms)").withValue(50).withMinimum(0).withMaximum(1000)); @EventHandler private Listener receiveListener = new Listener<>(e -> { @@ -24,9 +34,14 @@ public class AutoFish extends Module { int fishZ = (int) mc.player.fishEntity.posZ; if (kindaEquals(soundX, fishX) && kindaEquals(fishZ, soundZ)) { new Thread(() -> { - mc.rightClickMouse(); + Random ran = new Random(); try { - Thread.sleep(1000L); + Thread.sleep(extraDelay.getValue() + ran.ints(1, -variation.getValue(), variation.getValue()).findFirst().getAsInt()); + } catch (InterruptedException ignored) { } + mc.rightClickMouse(); + ran = new Random(); + try { + Thread.sleep(baseDelay.getValue() + ran.ints(1, -variation.getValue(), variation.getValue()).findFirst().getAsInt()); } catch (InterruptedException e1) { e1.printStackTrace(); }