Merge pull request #526 from S-B99/feature/autofish#470

Make autofish faster
This commit is contained in:
Bella Who 2020-03-05 15:44:42 +00:00 committed by GitHub
commit 6304f5eb55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 2 deletions

View File

@ -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<Integer> baseDelay = register(Settings.integerBuilder("Throw Delay (ms)").withValue(100).withMinimum(50).withMaximum(1000));
private Setting<Integer> extraDelay = register(Settings.integerBuilder("Catch Delay (ms)").withValue(300).withMinimum(0).withMaximum(1000));
private Setting<Integer> variation = register(Settings.integerBuilder("Variation (ms)").withValue(50).withMinimum(0).withMaximum(1000));
@EventHandler
private Listener<PacketEvent.Receive> 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();
}