From c6c4c56c5fec40a9e23ab943b8376c369cce7e5b Mon Sep 17 00:00:00 2001 From: May2Beez Date: Sat, 16 Dec 2023 13:35:47 +0100 Subject: [PATCH] = Auto Repellant - Another possible fix = Pest Destroyer - Fixed not flying after tp'ing to water + Logs --- .../com/jelly/farmhelperv2/feature/impl/AutoRepellent.java | 4 ++-- .../jelly/farmhelperv2/feature/impl/PestsDestroyer.java | 7 ++----- src/main/java/com/jelly/farmhelperv2/util/PlayerUtils.java | 3 +-- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/jelly/farmhelperv2/feature/impl/AutoRepellent.java b/src/main/java/com/jelly/farmhelperv2/feature/impl/AutoRepellent.java index 4c3308a0..a107a62e 100644 --- a/src/main/java/com/jelly/farmhelperv2/feature/impl/AutoRepellent.java +++ b/src/main/java/com/jelly/farmhelperv2/feature/impl/AutoRepellent.java @@ -29,7 +29,7 @@ public class AutoRepellent implements IFeature { private static AutoRepellent instance; public final static Clock repellentFailsafeClock = new Clock(); - private final Pattern repellentRegex = Pattern.compile("(\\d+)m\\s(\\d+)s"); + private final Pattern repellentRegex = Pattern.compile("(\\d+?)m?\\s?(\\d+)s"); private int savedSlot = 0; @@ -391,7 +391,7 @@ public void onChatReceived(ClientChatReceivedEvent event) { } else if (state == State.WAIT_FOR_REPELLENT) { System.out.println(message); if (message.startsWith("YUM! Pests will now spawn")) { - repellentFailsafeClock.schedule(TimeUnit.MILLISECONDS.convert(1, TimeUnit.HOURS)); + repellentFailsafeClock.schedule(TimeUnit.MILLISECONDS.convert(1, TimeUnit.HOURS) + 5_000); LogUtils.sendDebug("Repellent used!"); if (this.hotbarSlot == -1) { state = State.NONE; diff --git a/src/main/java/com/jelly/farmhelperv2/feature/impl/PestsDestroyer.java b/src/main/java/com/jelly/farmhelperv2/feature/impl/PestsDestroyer.java index 69e2cfda..2f732f55 100644 --- a/src/main/java/com/jelly/farmhelperv2/feature/impl/PestsDestroyer.java +++ b/src/main/java/com/jelly/farmhelperv2/feature/impl/PestsDestroyer.java @@ -817,13 +817,10 @@ private void flyAwayFromGround() { stop(); return; } - if (mc.thePlayer.motionY == 0) { - delayClock.schedule(400); - return; - } + if (mc.thePlayer.onGround && !PlayerUtils.isPlayerSuffocating()) { KeyBindUtils.holdThese(mc.gameSettings.keyBindJump); - Multithreading.schedule(KeyBindUtils::stopMovement, 150, TimeUnit.MILLISECONDS); + Multithreading.schedule(KeyBindUtils::stopMovement, 280, TimeUnit.MILLISECONDS); Multithreading.schedule(() -> { if (!mc.thePlayer.capabilities.isFlying && !mc.thePlayer.onGround) { mc.thePlayer.capabilities.isFlying = true; diff --git a/src/main/java/com/jelly/farmhelperv2/util/PlayerUtils.java b/src/main/java/com/jelly/farmhelperv2/util/PlayerUtils.java index 81b5b162..4c3aa972 100644 --- a/src/main/java/com/jelly/farmhelperv2/util/PlayerUtils.java +++ b/src/main/java/com/jelly/farmhelperv2/util/PlayerUtils.java @@ -121,8 +121,7 @@ public static void getTool() { LogUtils.sendDebug("No tool found!"); return; } - LogUtils.sendDebug("Tool id: " + id); - LogUtils.sendDebug("Current item: " + mc.thePlayer.inventory.currentItem); + LogUtils.sendDebug("Tool id: " + id + " current item: " + mc.thePlayer.inventory.currentItem); if (id == mc.thePlayer.inventory.currentItem) return; mc.thePlayer.inventory.currentItem = id; }