forked from RepoMirrors/kami-blue
Merge pull request #526 from S-B99/feature/autofish#470
Make autofish faster
This commit is contained in:
commit
6304f5eb55
|
@ -2,15 +2,25 @@ package me.zeroeightsix.kami.module.modules.misc;
|
||||||
|
|
||||||
import me.zero.alpine.listener.EventHandler;
|
import me.zero.alpine.listener.EventHandler;
|
||||||
import me.zero.alpine.listener.Listener;
|
import me.zero.alpine.listener.Listener;
|
||||||
|
import me.zeroeightsix.kami.command.Command;
|
||||||
import me.zeroeightsix.kami.event.events.PacketEvent;
|
import me.zeroeightsix.kami.event.events.PacketEvent;
|
||||||
import me.zeroeightsix.kami.module.Module;
|
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 net.minecraft.network.play.server.SPacketSoundEffect;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by 086 on 22/03/2018.
|
* 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")
|
@Module.Info(name = "AutoFish", category = Module.Category.MISC, description = "Automatically catch fish")
|
||||||
public class AutoFish extends Module {
|
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
|
@EventHandler
|
||||||
private Listener<PacketEvent.Receive> receiveListener = new Listener<>(e -> {
|
private Listener<PacketEvent.Receive> receiveListener = new Listener<>(e -> {
|
||||||
|
@ -24,9 +34,14 @@ public class AutoFish extends Module {
|
||||||
int fishZ = (int) mc.player.fishEntity.posZ;
|
int fishZ = (int) mc.player.fishEntity.posZ;
|
||||||
if (kindaEquals(soundX, fishX) && kindaEquals(fishZ, soundZ)) {
|
if (kindaEquals(soundX, fishX) && kindaEquals(fishZ, soundZ)) {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
mc.rightClickMouse();
|
Random ran = new Random();
|
||||||
try {
|
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) {
|
} catch (InterruptedException e1) {
|
||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue