Skip to content

Commit

Permalink
Good, old pre-release
Browse files Browse the repository at this point in the history
Rewarp:
+ Prevents from adding one near the spawn location (and vice versa)

Auto Pest Exchange:
+ Restored Baritone (togglable, disabled by default), crashes for some people idk why
  • Loading branch information
onixiya1337 committed May 6, 2024
1 parent ebe94e0 commit d8e9646
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 7 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.21
version=2.6.22-pre1
shouldRelease=true
19 changes: 19 additions & 0 deletions src/main/java/com/jelly/farmhelperv2/config/FarmHelperConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.jelly.farmhelperv2.util.helper.AudioManager;
import lombok.Getter;
import net.minecraft.client.Minecraft;
import net.minecraft.util.BlockPos;
import net.minecraftforge.fml.common.Loader;
import org.lwjgl.input.Keyboard;

Expand Down Expand Up @@ -1367,6 +1368,20 @@ public static void triggerManuallyPestsDestroyer() {
description = "Start the Auto Pest Exchange regardless of the next Jacob's contests"
)
public static boolean autoPestExchangeIgnoreJacobsContest = false;
@DualOption(
name = "Travel method", category = AUTO_PEST_EXCHANGE, subcategory = "Auto Pest Exchange",
description = "The travel method to use to get to the pest exchange desk",
left = "Fly",
right = "Walk"
)
public static boolean autoPestExchangeTravelMethod = false;
@Info(
text = "If you have any issues, try switching the travel method.",
type = InfoType.INFO,
category = AUTO_PEST_EXCHANGE,
subcategory = "Auto Pest Exchange",
size = 2
)
@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 Expand Up @@ -2153,6 +2168,10 @@ public static void addRewarp() {
return;
}
Rewarp newRewarp = new Rewarp(BlockUtils.getRelativeBlockPos(0, 0, 0));
if (newRewarp.getDistance(new BlockPos(PlayerUtils.getSpawnLocation())) < 2) {
LogUtils.sendError("Rewarp location is too close to the spawn location! You must put it AT THE END OF THE FARM!");
return;
}
rewarpList.add(newRewarp);
LogUtils.sendSuccess("Added rewarp: " + newRewarp);
saveRewarpConfig();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,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 @@ -111,7 +112,7 @@ public void stop() {
KeyBindUtils.stopMovement();
resetStatesAfterMacroDisabled();
FlyPathFinderExecutor.getInstance().stop();
// BaritoneHandler.stopPathing();
BaritoneHandler.stopPathing();
manuallyStarted = false;
IFeature.super.stop();
}
Expand Down Expand Up @@ -247,9 +248,12 @@ public void onTickExecutionNew(TickEvent.ClientTickEvent event) {
break;
}
if (isDeskPosSet()) {
FlyPathFinderExecutor.getInstance().setSprinting(false);
FlyPathFinderExecutor.getInstance().setDontRotate(true);
FlyPathFinderExecutor.getInstance().findPath(new Vec3(deskPos()).addVector(0.5f, 0.1f, 0.5f), true, true);
if (!FarmHelperConfig.autoPestExchangeTravelMethod) {
FlyPathFinderExecutor.getInstance().setSprinting(false);
FlyPathFinderExecutor.getInstance().setDontRotate(true);
FlyPathFinderExecutor.getInstance().findPath(new Vec3(deskPos()).addVector(0.5f, 0.1f, 0.5f), true, true);
} else
BaritoneHandler.walkToBlockPos(deskPos());
newState = NewState.ROTATE_TO_PHILLIP;
break;
}
Expand All @@ -264,11 +268,14 @@ public void onTickExecutionNew(TickEvent.ClientTickEvent event) {
}
phillip = getPhillip();
if (phillip == null) {
if (!FlyPathFinderExecutor.getInstance().isRunning()) {
if (!FlyPathFinderExecutor.getInstance().isRunning() && !FarmHelperConfig.autoPestExchangeTravelMethod) {
FlyPathFinderExecutor.getInstance().setSprinting(false);
FlyPathFinderExecutor.getInstance().setDontRotate(true);
FlyPathFinderExecutor.getInstance().findPath(new Vec3(initialDeskPos).addVector(0.5f, 0.5f, 0.5f), true, true);
}
if (!BaritoneHandler.isPathing() && FarmHelperConfig.autoPestExchangeTravelMethod) {
BaritoneHandler.isWalkingToGoalBlock(0.5);
}
LogUtils.sendDebug("[Auto Pest Exchange] Phillip not found! Looking for him.");
break;
}
Expand All @@ -279,6 +286,7 @@ public void onTickExecutionNew(TickEvent.ClientTickEvent event) {
break;
}
FlyPathFinderExecutor.getInstance().stop();
BaritoneHandler.stopPathing();
BlockPos closestPos = new BlockPos(closestVec);
FarmHelperConfig.pestExchangeDeskX = closestPos.getX();
FarmHelperConfig.pestExchangeDeskY = closestPos.getY();
Expand All @@ -300,7 +308,7 @@ public void onTickExecutionNew(TickEvent.ClientTickEvent event) {
)
);
}
if (FlyPathFinderExecutor.getInstance().isRunning()) {
if (FlyPathFinderExecutor.getInstance().isRunning() || BaritoneHandler.isWalkingToGoalBlock(0.5)) {
break;
}
newState = NewState.CLICK_PHILLIP;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,13 @@ public void onChatMessageReceived(ClientChatReceivedEvent event) {
if (!message.contains(":") && GameStateHandler.getInstance().inGarden()) {
if (message.equals("Your spawn location has been set!")) {
PlayerUtils.setSpawnLocation();
for (Rewarp rewarp : FarmHelperConfig.rewarpList) {
if (mc.thePlayer.getDistance(rewarp.x, rewarp.y, rewarp.z) < 2) {
LogUtils.sendWarning("Spawn location is close to the rewarp location! Removing it from the list...");
FarmHelperConfig.rewarpList.remove(rewarp);
break;
}
}
}
}
}
Expand Down

0 comments on commit d8e9646

Please sign in to comment.