Skip to content

Commit

Permalink
Hopefully Visitors Macro still works with the good, old Baritone o.o
Browse files Browse the repository at this point in the history
  • Loading branch information
onixiya1337 committed May 11, 2024
1 parent d8e9646 commit 190b1d1
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 11 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.6.22-pre1
version=2.6.22-pre2
shouldRelease=true
17 changes: 17 additions & 0 deletions src/main/java/com/jelly/farmhelperv2/config/FarmHelperConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,22 @@ public class FarmHelperConfig extends Config {
)
public static boolean visitorsMacroAfkInfiniteMode = false;

@DualOption(
name = "Travel method", category = VISITORS_MACRO, subcategory = "Visitors Macro",
description = "The travel method to use to get to the pest exchange desk",
left = "Fly",
right = "Walk"
)
public static boolean visitorsExchangeTravelMethod = false;
@Info(
text = "If you have any issues, try switching the travel method.",
type = InfoType.INFO,
category = VISITORS_MACRO,
subcategory = "Visitors Macro",
size = 2
)
public static boolean visitorsExchangeTravelMethodInfo;

@Button(
name = "Start the macro manually", category = VISITORS_MACRO, subcategory = "Visitors Macro",
description = "Triggers the visitors macro",
Expand Down Expand Up @@ -1382,6 +1398,7 @@ public static void triggerManuallyPestsDestroyer() {
subcategory = "Auto Pest Exchange",
size = 2
)
public static boolean autoPestExchangeTravelMethodInfo;
@Slider(
name = "Trigger before contest starts (in minutes)", category = AUTO_PEST_EXCHANGE, subcategory = "Auto Pest Exchange",
description = "The time before the contest starts to trigger the auto pest exchange",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.jelly.farmhelperv2.config.FarmHelperConfig;
import com.jelly.farmhelperv2.feature.FeatureManager;
import com.jelly.farmhelperv2.feature.IFeature;
import com.jelly.farmhelperv2.handler.BaritoneHandler;
import com.jelly.farmhelperv2.handler.GameStateHandler;
import com.jelly.farmhelperv2.handler.MacroHandler;
import com.jelly.farmhelperv2.handler.RotationHandler;
Expand Down Expand Up @@ -172,7 +173,7 @@ public void stop() {
AutoBazaar.getInstance().stop();
PlayerUtils.closeScreen();
KeyBindUtils.stopMovement();
// BaritoneHandler.stopPathing();
BaritoneHandler.stopPathing();
MacroHandler.getInstance().getCurrentMacro().ifPresent(cm -> cm.getCheckOnSpawnClock().schedule(5_000));
Multithreading.schedule(() -> {
servedCustomers.clear();
Expand Down Expand Up @@ -671,10 +672,10 @@ private void onVisitorsState() {
delayClock.schedule(FarmHelperConfig.getRandomGUIMacroDelay());
break;
}
// if (BaritoneHandler.isWalkingToGoalBlock()) {
// return;
// }
if (FlyPathFinderExecutor.getInstance().isRunning()) {
if (FarmHelperConfig.visitorsExchangeTravelMethod && BaritoneHandler.isWalkingToGoalBlock()) {
return;
}
if (!FarmHelperConfig.visitorsExchangeTravelMethod && FlyPathFinderExecutor.getInstance().isRunning()) {
if (!RotationHandler.getInstance().isRotating() && currentCharacter.isPresent()) {
RotationHandler.getInstance().easeTo(
new RotationConfiguration(
Expand All @@ -695,10 +696,13 @@ private void onVisitorsState() {
Vec3 closestVec = PlayerUtils.getClosestVecAround(currentCharacter.get(), 1.25, 90, 45);
closestVec = noClosestVecFallback(closestVec);
if (closestVec == null) return;
// BaritoneHandler.walkCloserToBlockPos(currentCharacter.get().getPosition(), 1);
FlyPathFinderExecutor.getInstance().setSprinting(false);
FlyPathFinderExecutor.getInstance().setDontRotate(true);
FlyPathFinderExecutor.getInstance().findPath(closestVec.addVector(0, 1.8, 0), false, true);
if (FarmHelperConfig.visitorsExchangeTravelMethod)
BaritoneHandler.walkCloserToBlockPos(currentCharacter.get().getPosition(), 2);
else {
FlyPathFinderExecutor.getInstance().setSprinting(false);
FlyPathFinderExecutor.getInstance().setDontRotate(true);
FlyPathFinderExecutor.getInstance().findPath(closestVec.addVector(0, 1.8, 0), false, true);
}
}
RotationHandler.getInstance().easeTo(
new RotationConfiguration(
Expand All @@ -716,7 +720,7 @@ private void onVisitorsState() {
delayClock.schedule(FarmHelperConfig.getRandomGUIMacroDelay());
break;
}
if (FlyPathFinderExecutor.getInstance().isPathing()) {
if (FlyPathFinderExecutor.getInstance().isPathing() || BaritoneHandler.isPathing()) {
return;
}
if (currentCharacter.isPresent() && mc.thePlayer.getDistanceToEntity(currentCharacter.get()) > 3) {
Expand Down

0 comments on commit 190b1d1

Please sign in to comment.