Skip to content

Commit

Permalink
Increased lower avg BPS cooldown, world change failsafe fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
onixiya1337 committed Jul 19, 2024
1 parent 28ad9f0 commit e23dedd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = " "
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand Down
13 changes: 1 addition & 12 deletions src/main/java/com/jelly/farmhelperv2/util/InventoryUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit e23dedd

Please sign in to comment.