Skip to content

Commit

Permalink
v2.4.1-pre7
Browse files Browse the repository at this point in the history
= Restart after failsafe - added support for more failsafes; setting this value to 0 minutes will result in restarting the macro in a few seconds after finish failsafe
= Auto Pest Hunter - crash fix
  • Loading branch information
onixiya1337 committed Jan 11, 2024
1 parent 57bd3ed commit 141a5a6
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 5 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.4.1-pre6
version=2.4.1-pre7
shouldRelease=true
Original file line number Diff line number Diff line change
Expand Up @@ -801,9 +801,14 @@ public enum SPRAYONATOR_ITEM {
@Slider(
name = "Restart Delay", category = FAILSAFE, subcategory = "Restart After FailSafe",
description = "The delay to restart after failsafe (in minutes)",
min = 0, max = 60
min = 0, max = 20
)
public static int restartAfterFailSafeDelay = 5;
@Info(
text = "Setting this value to 0 will start the macro a few seconds later, after the failsafe is finished",
category = FAILSAFE, subcategory = "Restart After FailSafe",
type = InfoType.INFO, size = 2
)

@Switch(
name = "Always teleport to /warp garden after the failsafe",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ else if (BlockUtils.getRelativeBlock(1, 1, 0).equals(Blocks.bedrock))

@Override
public void endOfFailsafeTrigger() {
FailsafeManager.getInstance().restartMacroAfterDelay();
FailsafeManager.getInstance().stopFailsafes();
FailsafeManager.getInstance().restartMacroAfterDelay();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public void duringFailsafeTrigger() {
public void endOfFailsafeTrigger() {
FailsafeManager.getInstance().stopFailsafes();
if (mc.thePlayer.getPosition().getY() < 100 && GameStateHandler.getInstance().getLocation() == GameStateHandler.Location.GARDEN)
MacroHandler.getInstance().resumeMacro();
FailsafeManager.getInstance().restartMacroAfterDelay();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public void duringFailsafeTrigger() {
public void endOfFailsafeTrigger() {
FailsafeManager.getInstance().stopFailsafes();
if (mc.thePlayer.getPosition().getY() < 100 && GameStateHandler.getInstance().getLocation() == GameStateHandler.Location.GARDEN)
MacroHandler.getInstance().resumeMacro();
FailsafeManager.getInstance().restartMacroAfterDelay();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ public void onTickExecution(TickEvent.ClientTickEvent event) {
filter(entity ->
entity.hasCustomName() && entity.getCustomNameTag().contains(StringUtils.stripControlCodes("Phillip")))
.min(Comparator.comparingDouble(entity -> entity.getDistanceSqToCenter(mc.thePlayer.getPosition()))).orElse(null);
if (closest == null) {
break;
}
rotation.easeTo(
new RotationConfiguration(
new Target(closest),
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/jelly/farmhelperv2/feature/impl/Scheduler.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,21 @@ public void onTick(TickEvent.ClientTickEvent event) {
if (FarmHelperConfig.pauseSchedulerDuringJacobsContest && GameStateHandler.getInstance().inJacobContest() && !GameStateHandler.getInstance().isWasInJacobContest()) {
LogUtils.sendDebug("[Scheduler] Jacob contest started, pausing scheduler");
schedulerClock.pause();
if (schedulerState == SchedulerState.BREAK) {
if (mc.currentScreen != null) {
PlayerUtils.closeScreen();
}
MacroHandler.getInstance().resumeMacro();
pause();
}
GameStateHandler.getInstance().setWasInJacobContest(true);
return;
} else if (FarmHelperConfig.pauseSchedulerDuringJacobsContest && GameStateHandler.getInstance().isWasInJacobContest() && !GameStateHandler.getInstance().inJacobContest()) {
LogUtils.sendDebug("[Scheduler] Jacob contest ended, resuming scheduler");
schedulerClock.resume();
if (schedulerState == SchedulerState.BREAK) {
MacroHandler.getInstance().pauseMacro();
}
GameStateHandler.getInstance().setWasInJacobContest(false);
return;
}
Expand Down

0 comments on commit 141a5a6

Please sign in to comment.