Skip to content

Commit

Permalink
AutoSell:
Browse files Browse the repository at this point in the history
 = Tweaks

Auto Reconnect:
 + Takes into account possible limbo escape

Cultivating:
 = Possible fix for not counting it
  • Loading branch information
May2Beez committed Apr 15, 2024
1 parent 688dd25 commit 6699102
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ baseGroup=com.jelly.farmhelperv2
mcVersion=1.8.9
modid=farmhelperv2
modName=FarmHelper
version=2.5.22
version=2.5.23
shouldRelease=true
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,31 @@ public void onTick(TickEvent.ClientTickEvent event) {
reconnectDelay.schedule(5_000);
break;
}
if (GameStateHandler.getInstance().getLocation() == GameStateHandler.Location.LOBBY || !GameStateHandler.getInstance().inGarden()) {
if (GameStateHandler.getInstance().getLocation() == GameStateHandler.Location.LOBBY) {
System.out.println("Reconnected to the lobby!");
LogUtils.sendDebug("[Reconnect] Came back to the lobby.");
mc.thePlayer.sendChatMessage("/skyblock");
state = State.GARDEN;
reconnectDelay.schedule(5_000);
break;
}
if (GameStateHandler.getInstance().inGarden()) {
System.out.println("Reconnected to the garden!");
LogUtils.sendDebug("[Reconnect] Came back to the garden!");
stop();
break;
}
if (GameStateHandler.getInstance().getLocation() == GameStateHandler.Location.LIMBO) {
System.out.println("In limbo!");
LogUtils.sendDebug("[Reconnect] In limbo.");
mc.thePlayer.sendChatMessage("/lobby");
state = State.LOBBY;
reconnectDelay.schedule(5_000);
break;
}
if (!GameStateHandler.getInstance().inGarden()) {
MacroHandler.getInstance().triggerWarpGarden(true, false);
reconnectDelay.schedule(5_000);
}
break;
case GARDEN:
Expand All @@ -192,6 +206,12 @@ public void onTick(TickEvent.ClientTickEvent event) {
} else if (GameStateHandler.getInstance().getLocation() == GameStateHandler.Location.LOBBY) {
state = State.LOBBY;
reconnectDelay.schedule(60_000);
} else if (GameStateHandler.getInstance().getLocation() == GameStateHandler.Location.LIMBO) {
System.out.println("In limbo!");
LogUtils.sendDebug("[Reconnect] In limbo.");
mc.thePlayer.sendChatMessage("/lobby");
state = State.LOBBY;
reconnectDelay.schedule(5_000);
} else {
MacroHandler.getInstance().triggerWarpGarden(true, false);
reconnectDelay.schedule(5_000);
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/com/jelly/farmhelperv2/feature/impl/AutoSell.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,23 @@ public static AutoSell getInstance() {
private NPCState npcState = NPCState.NONE;

public void setNpcState(NPCState npcState) {
timeoutClock.schedule(30_000);
timeoutClock.schedule(5_000);
this.npcState = npcState;
}

@Getter
private BazaarState bazaarState = BazaarState.NONE;

public void setBazaarState(BazaarState bazaarState) {
timeoutClock.schedule(30_000);
timeoutClock.schedule(5_000);
this.bazaarState = bazaarState;
}

@Getter
private SacksState sacksState = SacksState.NONE;

public void setSacksState(SacksState sacksState) {
timeoutClock.schedule(30_000);
timeoutClock.schedule(5_000);
this.sacksState = sacksState;
}

Expand Down Expand Up @@ -166,7 +166,7 @@ public void enable(boolean manually) {
bazaarState = BazaarState.NONE;
sacksState = SacksState.NONE;
delayClock.reset();
timeoutClock.schedule(30_000);
timeoutClock.schedule(5_000);
if (manually) {
dontEnableForClock.reset();
}
Expand Down Expand Up @@ -354,6 +354,7 @@ public void onTickEnabled(TickEvent.ClientTickEvent event) {
setBazaarState(BazaarState.SELL_INV);
break;
}
setBazaarState(BazaarState.SELL_INV);
break;
case SELL_INV:
if (mc.currentScreen == null) {
Expand Down Expand Up @@ -502,6 +503,7 @@ public void onTickEnabled(TickEvent.ClientTickEvent event) {
LogUtils.sendDebug("[Auto Sell] Selling " + name);
InventoryUtils.clickSlotWithId(slot.slotNumber, InventoryUtils.ClickType.LEFT, InventoryUtils.ClickMode.PICKUP, chest.windowId);
delayClock.schedule(FarmHelperConfig.getRandomGUIMacroDelay());
timeoutClock.schedule(5_000);
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,8 @@ private void checkInfestedPlotsTabList(String cleanedLine) {
for (int i = 1; i < split.length; i++) {
try {
infestedPlots.add(Integer.parseInt(split[i].replace(",", "")));
} catch (Exception ignored) {}
} catch (Exception ignored) {
}
}
} catch (Exception ignored) {
infestedPlots.clear();
Expand Down Expand Up @@ -695,7 +696,7 @@ public Long getCultivating(ItemStack item) {
if (tag.hasKey("ExtraAttributes", 10)) {
NBTTagCompound ea = tag.getCompoundTag("ExtraAttributes");

if (ea.hasKey("farmed_cultivating", 99)) {
if (ea.hasKey("farmed_cultivating", 99) || ea.hasKey("mined_crops", 99)) {
return (long) ea.getInteger("farmed_cultivating");
}
}
Expand Down

0 comments on commit 6699102

Please sign in to comment.