From e23deddb4182d5bcee40146a4804cd395558abda Mon Sep 17 00:00:00 2001 From: onixiya1337 <47077455+onixiya1337@users.noreply.github.com> Date: Fri, 19 Jul 2024 10:24:16 +0200 Subject: [PATCH] Increased lower avg BPS cooldown, world change failsafe fixes --- .../farmhelperv2/config/FarmHelperConfig.java | 14 +++++++------- .../failsafe/impl/LowerAvgBpsFailsafe.java | 2 +- .../failsafe/impl/WorldChangeFailsafe.java | 8 +++++--- .../jelly/farmhelperv2/util/InventoryUtils.java | 13 +------------ 4 files changed, 14 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/jelly/farmhelperv2/config/FarmHelperConfig.java b/src/main/java/com/jelly/farmhelperv2/config/FarmHelperConfig.java index c9a77536..88f6207b 100644 --- a/src/main/java/com/jelly/farmhelperv2/config/FarmHelperConfig.java +++ b/src/main/java/com/jelly/farmhelperv2/config/FarmHelperConfig.java @@ -1972,13 +1972,13 @@ public static void triggerManuallyAutoPestExchange() { name = "Reset stats between disabling", category = HUD, subcategory = "Profit Calculator" ) public static boolean resetStatsBetweenDisabling = false; - @Button( - name = "Reset Profit Calculator", category = HUD, subcategory = "Profit Calculator", - text = "Reset Now", size = 2 - ) - public void resetStats() { - ProfitCalculator.getInstance().resetProfits(); - } +// @Button( +// name = "Reset Profit Calculator", category = HUD, subcategory = "Profit Calculator", +// text = "Reset Now", size = 2 +// ) +// public void resetStats() { +// ProfitCalculator.getInstance().resetProfits(); +// } @HUD( name = "Profit Calculator HUD - Visual Settings", category = HUD, subcategory = " " ) diff --git a/src/main/java/com/jelly/farmhelperv2/failsafe/impl/LowerAvgBpsFailsafe.java b/src/main/java/com/jelly/farmhelperv2/failsafe/impl/LowerAvgBpsFailsafe.java index 89723aa1..4e8d01c0 100644 --- a/src/main/java/com/jelly/farmhelperv2/failsafe/impl/LowerAvgBpsFailsafe.java +++ b/src/main/java/com/jelly/farmhelperv2/failsafe/impl/LowerAvgBpsFailsafe.java @@ -81,7 +81,7 @@ public void onTickDetection(TickEvent.ClientTickEvent event) { clock.schedule(4500L + Math.random() * 1000L); // LogUtils.sendDebug("LowerAvgBpsFailsafe: BPS below threshold. Current: " + currentBPS + ", Threshold: " + FarmHelperConfig.minBpsThreshold); } else if (clock.passed()) { - if (System.currentTimeMillis() - lastTriggered < 20000L) { + if (System.currentTimeMillis() - lastTriggered < 60_000L) { resetStates(); return; } diff --git a/src/main/java/com/jelly/farmhelperv2/failsafe/impl/WorldChangeFailsafe.java b/src/main/java/com/jelly/farmhelperv2/failsafe/impl/WorldChangeFailsafe.java index b9b862b0..1dd6cd6f 100644 --- a/src/main/java/com/jelly/farmhelperv2/failsafe/impl/WorldChangeFailsafe.java +++ b/src/main/java/com/jelly/farmhelperv2/failsafe/impl/WorldChangeFailsafe.java @@ -134,11 +134,13 @@ public void duringFailsafeTrigger() { worldChangeState = WorldChangeState.END; break; case END: - if (GameStateHandler.getInstance().getLocation() == GameStateHandler.Location.TELEPORTING) { + if (GameStateHandler.getInstance().getLocation() == GameStateHandler.Location.TELEPORTING + || LagDetector.getInstance().isLagging()) { FailsafeManager.getInstance().scheduleDelay(1000); return; } - if (GameStateHandler.getInstance().getLocation() == GameStateHandler.Location.LOBBY && !LagDetector.getInstance().isLagging()) { + if (GameStateHandler.getInstance().getLocation() == GameStateHandler.Location.LOBBY + || GameStateHandler.getInstance().getLocation() == GameStateHandler.Location.UNKNOWN) { LogUtils.sendDebug("[Failsafe] In lobby, sending /skyblock command..."); mc.thePlayer.sendChatMessage("/skyblock"); if (sendOnce) { @@ -162,7 +164,7 @@ public void duringFailsafeTrigger() { FailsafeManager.getInstance().stopFailsafes(); MacroHandler.getInstance().resumeMacro(); return; - } else if (!LagDetector.getInstance().isLagging()) { + } else { LogUtils.sendDebug("[Failsafe] Sending /warp garden command..."); MacroHandler.getInstance().triggerWarpGarden(true, false); FailsafeManager.getInstance().scheduleRandomDelay(8500, 1000); diff --git a/src/main/java/com/jelly/farmhelperv2/util/InventoryUtils.java b/src/main/java/com/jelly/farmhelperv2/util/InventoryUtils.java index 5a1b576f..d8f1c74e 100644 --- a/src/main/java/com/jelly/farmhelperv2/util/InventoryUtils.java +++ b/src/main/java/com/jelly/farmhelperv2/util/InventoryUtils.java @@ -259,8 +259,7 @@ public static int getAmountOfItemInInventory(String item) { public static boolean canFitItemInInventory(String item, int amount) { int freeSpace = 0; int currentAmount = getAmountOfItemInInventory(item); - boolean isStackable = isItemStackable(item); - int maxStackSize = isStackable ? 64 : 1; + int maxStackSize = item.toLowerCase().contains("cake") ? 1 : 64; for (Slot slot : mc.thePlayer.inventoryContainer.inventorySlots) { if (!slot.getHasStack()) { freeSpace += maxStackSize; @@ -275,16 +274,6 @@ public static boolean canFitItemInInventory(String item, int amount) { return false; } - private static boolean isItemStackable(String item) { - String[] nonStackableItems = {"Spawn Egg", "Cake", "Bucket", "Sword", "Pickaxe", "Axe", "Shovel", "Hoe", "Helmet", "Chestplate", "Leggings", "Boots"}; - for (String nonStackable : nonStackableItems) { - if (item.contains(nonStackable)) { - return false; - } - } - return true; - } - public static int getRancherBootSpeed() { final ItemStack stack = mc.thePlayer.inventoryContainer.getSlot(8).getStack(); int speed = -1;