Skip to content

Commit

Permalink
v2.4.4-pre2 update
Browse files Browse the repository at this point in the history
= Auto Pest Hunter - bug fixes
= Changing lanes tweaks
  • Loading branch information
onixiya1337 committed Jan 20, 2024
1 parent 19a9a38 commit f356f4c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 12 deletions.
4 changes: 2 additions & 2 deletions 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.4.4-pre1
shouldRelease=false
version=2.4.4-pre2
shouldRelease=true
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ public boolean shouldIgnoreFalseCheck() {
if (VisitorsMacro.getInstance().isRunning() && !VisitorsMacro.getInstance().shouldCheckForFailsafes()) {
return true;
}
if (AutoPestHunter.getInstance().isRunning() && !AutoPestHunter.getInstance().shouldCheckForFailsafes()) {
return true;
}
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public static AutoPestHunter getInstance() {
@Getter
private final Clock delayClock = new Clock();
private BlockPos positionBeforeTp;
private int finishTries = 0;

private BlockPos deskPos() {
return new BlockPos(FarmHelperConfig.pestHunterDeskX, FarmHelperConfig.pestHunterDeskY, FarmHelperConfig.pestHunterDeskZ);
Expand Down Expand Up @@ -85,6 +86,7 @@ public void start() {
if (mc.thePlayer == null || mc.theWorld == null) return;
resetStatesAfterMacroDisabled();
enabled = true;
state = State.TELEPORT_TO_DESK;
LogUtils.sendWarning("[Auto Pest Hunter] Starting...");
}

Expand All @@ -105,6 +107,7 @@ public void resetStatesAfterMacroDisabled() {
stuckClock.reset();
delayClock.reset();
positionBeforeTp = null;
finishTries = 0;
}

@Override
Expand All @@ -114,12 +117,13 @@ public boolean isToggled() {

@Override
public boolean shouldCheckForFailsafes() {
return false;
return state == State.NONE || state == State.GO_BACK || state == State.EMPTY_VACUUM || state == State.GO_TO_PHILLIP || state == State.TELEPORT_TO_DESK;
}

enum State {
NONE,
TELEPORT_TO_DESK,
WAIT_FOR_TP,
GO_TO_PHILLIP,
CLICK_PHILLIP,
WAIT_FOR_GUI,
Expand Down Expand Up @@ -185,18 +189,20 @@ public void onTickExecution(TickEvent.ClientTickEvent event) {

switch (state) {
case NONE:
break;
case TELEPORT_TO_DESK:
if (mc.currentScreen != null) {
PlayerUtils.closeScreen();
break;
}
positionBeforeTp = mc.thePlayer.getPosition();
state = State.TELEPORT_TO_DESK;
state = State.WAIT_FOR_TP;
mc.thePlayer.sendChatMessage("/tptoplot barn");
delayClock.schedule((long) (1_000 + Math.random() * 500));
stuckClock.schedule(10_000L);
break;
case TELEPORT_TO_DESK:
if (mc.thePlayer.getPosition().equals(positionBeforeTp) || PlayerUtils.isPlayerSuffocating()) {
case WAIT_FOR_TP:
if (mc.thePlayer.getPosition().equals(positionBeforeTp)) {
LogUtils.sendDebug("[Auto Pest Hunter] Waiting for teleportation...");
break;
}
Expand Down Expand Up @@ -287,12 +293,20 @@ public void onTickExecution(TickEvent.ClientTickEvent event) {
break;
case GO_BACK:
if (!manuallyStarted) {
Multithreading.schedule(() -> {
MacroHandler.getInstance().triggerWarpGarden(true, false);
Multithreading.schedule(() -> {
MacroHandler.getInstance().resumeMacro();
}, 1_000, TimeUnit.MILLISECONDS);
}, 500, TimeUnit.MILLISECONDS);
if (PlayerUtils.isStandingOnSpawnPoint()) {
stop();
MacroHandler.getInstance().resumeMacro();
return;
}
if (finishTries == 7) {
LogUtils.sendError("[Auto Pest Hunter] Couldn't enable macro after teleportation! Check if your spawn point is set in mod (Yellow rectangle). If not, re-do command /setspawn");
LogUtils.webhookLog("[Auto Pest Hunter] Couldn't enable macro after teleportation!");
MacroHandler.getInstance().disableMacro();
return;
}
MacroHandler.getInstance().triggerWarpGarden(true, true);
finishTries++;
delayClock.schedule(1_000 + Math.random() * 500);
}
stop();
break;
Expand Down

0 comments on commit f356f4c

Please sign in to comment.