only one singleton

This commit is contained in:
Leijurv 2018-10-27 18:45:17 -07:00
parent c4b0e0a810
commit 1b1233d26a
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
13 changed files with 146 additions and 95 deletions

View File

@ -22,9 +22,7 @@ import baritone.api.event.events.BlockInteractEvent;
import baritone.api.event.events.TickEvent;
import baritone.api.event.events.WorldEvent;
import baritone.api.event.events.type.EventState;
import baritone.behavior.PathingBehavior;
import baritone.utils.BaritoneAutoTest;
import baritone.utils.ExampleBaritoneControl;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.GuiScreen;
@ -60,7 +58,6 @@ public class MixinMinecraft {
)
private void postInit(CallbackInfo ci) {
Baritone.INSTANCE.init();
ExampleBaritoneControl.INSTANCE.initAndRegister();
}
@Inject(
@ -145,7 +142,7 @@ public class MixinMinecraft {
)
)
private boolean isAllowUserInput(GuiScreen screen) {
return (PathingBehavior.INSTANCE.getCurrent() != null && PathingBehavior.INSTANCE.isEnabled() && player != null) || screen.allowUserInput;
return (Baritone.INSTANCE.getPathingBehavior().getCurrent() != null && Baritone.INSTANCE.getPathingBehavior().isEnabled() && player != null) || screen.allowUserInput;
}
@Inject(

View File

@ -18,11 +18,18 @@
package baritone;
import baritone.api.BaritoneAPI;
import baritone.api.IBaritoneProvider;
import baritone.api.Settings;
import baritone.api.behavior.*;
import baritone.api.cache.IWorldProvider;
import baritone.api.cache.IWorldScanner;
import baritone.api.event.listener.IGameEventListener;
import baritone.behavior.*;
import baritone.cache.WorldProvider;
import baritone.cache.WorldScanner;
import baritone.event.GameEventHandler;
import baritone.utils.BaritoneAutoTest;
import baritone.utils.ExampleBaritoneControl;
import baritone.utils.InputOverrideHandler;
import net.minecraft.client.Minecraft;
@ -40,7 +47,7 @@ import java.util.concurrent.TimeUnit;
* @author Brady
* @since 7/31/2018 10:50 PM
*/
public enum Baritone {
public enum Baritone implements IBaritoneProvider {
/**
* Singleton instance of this class
@ -55,10 +62,17 @@ public enum Baritone {
private GameEventHandler gameEventHandler;
private InputOverrideHandler inputOverrideHandler;
private Settings settings;
private List<Behavior> behaviors;
private File dir;
private ThreadPoolExecutor threadPool;
private List<Behavior> behaviors;
private PathingBehavior pathingBehavior;
private LookBehavior lookBehavior;
private MemoryBehavior memoryBehavior;
private LocationTrackingBehavior locationTrackingBehavior;
private FollowBehavior followBehavior;
private MineBehavior mineBehavior;
/**
* Whether or not Baritone is active
*/
@ -81,12 +95,14 @@ public enum Baritone {
this.behaviors = new ArrayList<>();
{
registerBehavior(PathingBehavior.INSTANCE);
registerBehavior(LookBehavior.INSTANCE);
registerBehavior(MemoryBehavior.INSTANCE);
registerBehavior(LocationTrackingBehavior.INSTANCE);
registerBehavior(FollowBehavior.INSTANCE);
registerBehavior(MineBehavior.INSTANCE);
// the Behavior constructor calls baritone.registerBehavior(this) so this populates the behaviors arraylist
pathingBehavior = new PathingBehavior(this);
lookBehavior = new LookBehavior(this);
memoryBehavior = new MemoryBehavior(this);
locationTrackingBehavior = new LocationTrackingBehavior(this);
followBehavior = new FollowBehavior(this);
mineBehavior = new MineBehavior(this);
new ExampleBaritoneControl(this);
}
if (BaritoneAutoTest.ENABLE_AUTO_TEST) {
registerEventListener(BaritoneAutoTest.INSTANCE);
@ -127,6 +143,42 @@ public enum Baritone {
this.registerEventListener(behavior);
}
@Override
public IFollowBehavior getFollowBehavior() {
return followBehavior;
}
@Override
public ILookBehavior getLookBehavior() {
return lookBehavior;
}
@Override
public IMemoryBehavior getMemoryBehavior() {
return memoryBehavior;
}
@Override
public IMineBehavior getMineBehavior() {
return mineBehavior;
}
@Override
public IPathingBehavior getPathingBehavior() {
return pathingBehavior;
}
@Override
public IWorldProvider getWorldProvider() {
return WorldProvider.INSTANCE;
}
@Override
public IWorldScanner getWorldScanner() {
return WorldScanner.INSTANCE;
}
@Override
public void registerEventListener(IGameEventListener listener) {
this.gameEventHandler.registerEventListener(listener);
}

View File

@ -22,11 +22,12 @@ import baritone.api.behavior.*;
import baritone.api.cache.IWorldProvider;
import baritone.api.cache.IWorldScanner;
import baritone.api.event.listener.IGameEventListener;
import baritone.behavior.*;
import baritone.cache.WorldProvider;
import baritone.cache.WorldScanner;
/**
* todo fix this cancer
*
* @author Brady
* @since 9/29/2018
*/
@ -34,27 +35,27 @@ public final class BaritoneProvider implements IBaritoneProvider {
@Override
public IFollowBehavior getFollowBehavior() {
return FollowBehavior.INSTANCE;
return Baritone.INSTANCE.getFollowBehavior();
}
@Override
public ILookBehavior getLookBehavior() {
return LookBehavior.INSTANCE;
return Baritone.INSTANCE.getLookBehavior();
}
@Override
public IMemoryBehavior getMemoryBehavior() {
return MemoryBehavior.INSTANCE;
return Baritone.INSTANCE.getMemoryBehavior();
}
@Override
public IMineBehavior getMineBehavior() {
return MineBehavior.INSTANCE;
return Baritone.INSTANCE.getMineBehavior();
}
@Override
public IPathingBehavior getPathingBehavior() {
return PathingBehavior.INSTANCE;
return Baritone.INSTANCE.getPathingBehavior();
}
@Override

View File

@ -17,6 +17,7 @@
package baritone.behavior;
import baritone.Baritone;
import baritone.api.behavior.IBehavior;
/**
@ -27,6 +28,13 @@ import baritone.api.behavior.IBehavior;
*/
public class Behavior implements IBehavior {
public final Baritone baritone;
protected Behavior(Baritone baritone) {
this.baritone = baritone;
baritone.registerBehavior(this);
}
/**
* Whether or not this behavior is enabled
*/

View File

@ -33,11 +33,11 @@ import net.minecraft.util.math.BlockPos;
*/
public final class FollowBehavior extends Behavior implements IFollowBehavior, Helper {
public static final FollowBehavior INSTANCE = new FollowBehavior();
private Entity following;
private FollowBehavior() {}
public FollowBehavior(Baritone baritone) {
super(baritone);
}
@Override
public void onTick(TickEvent event) {
@ -56,9 +56,9 @@ public final class FollowBehavior extends Behavior implements IFollowBehavior, H
GoalXZ g = GoalXZ.fromDirection(following.getPositionVector(), Baritone.settings().followOffsetDirection.get(), Baritone.settings().followOffsetDistance.get());
pos = new BlockPos(g.getX(), following.posY, g.getZ());
}
PathingBehavior.INSTANCE.setGoal(new GoalNear(pos, Baritone.settings().followRadius.get()));
PathingBehavior.INSTANCE.revalidateGoal();
PathingBehavior.INSTANCE.path();
baritone.getPathingBehavior().setGoal(new GoalNear(pos, Baritone.settings().followRadius.get()));
((PathingBehavior) baritone.getPathingBehavior()).revalidateGoal();
baritone.getPathingBehavior().path();
}
@Override
@ -73,7 +73,7 @@ public final class FollowBehavior extends Behavior implements IFollowBehavior, H
@Override
public void cancel() {
PathingBehavior.INSTANCE.cancel();
baritone.getPathingBehavior().cancel();
follow(null);
}
}

View File

@ -17,6 +17,7 @@
package baritone.behavior;
import baritone.Baritone;
import baritone.api.event.events.BlockInteractEvent;
import baritone.cache.Waypoint;
import baritone.cache.WorldProvider;
@ -28,16 +29,15 @@ import net.minecraft.block.BlockBed;
* A collection of event methods that are used to interact with Baritone's
* waypoint system. This class probably needs a better name.
*
* @see Waypoint
*
* @author Brady
* @see Waypoint
* @since 8/22/2018
*/
public final class LocationTrackingBehavior extends Behavior implements Helper {
public static final LocationTrackingBehavior INSTANCE = new LocationTrackingBehavior();
private LocationTrackingBehavior() {}
public LocationTrackingBehavior(Baritone baritone) {
super(baritone);
}
@Override
public void onBlockInteract(BlockInteractEvent event) {

View File

@ -26,9 +26,6 @@ import baritone.api.utils.Rotation;
import baritone.utils.Helper;
public final class LookBehavior extends Behavior implements ILookBehavior, Helper {
public static final LookBehavior INSTANCE = new LookBehavior();
/**
* Target's values are as follows:
* <p>
@ -49,7 +46,9 @@ public final class LookBehavior extends Behavior implements ILookBehavior, Helpe
*/
private float lastYaw;
private LookBehavior() {}
public LookBehavior(Baritone baritone) {
super(baritone);
}
@Override
public void updateTarget(Rotation target, boolean force) {

View File

@ -17,6 +17,7 @@
package baritone.behavior;
import baritone.Baritone;
import baritone.api.behavior.IMemoryBehavior;
import baritone.api.behavior.memory.IRememberedInventory;
import baritone.api.cache.IWorldData;
@ -43,11 +44,11 @@ import java.util.*;
*/
public final class MemoryBehavior extends Behavior implements IMemoryBehavior, Helper {
public static MemoryBehavior INSTANCE = new MemoryBehavior();
private final Map<IWorldData, WorldDataContainer> worldDataContainers = new HashMap<>();
private MemoryBehavior() {}
public MemoryBehavior(Baritone baritone) {
super(baritone);
}
@Override
public synchronized void onPlayerUpdate(PlayerUpdateEvent event) {

View File

@ -46,14 +46,14 @@ import java.util.stream.Collectors;
*/
public final class MineBehavior extends Behavior implements IMineBehavior, Helper {
public static final MineBehavior INSTANCE = new MineBehavior();
private List<Block> mining;
private List<BlockPos> knownOreLocations;
private BlockPos branchPoint;
private int desiredQuantity;
private MineBehavior() {}
public MineBehavior(Baritone baritone) {
super(baritone);
}
@Override
public void onTick(TickEvent event) {
@ -82,7 +82,7 @@ public final class MineBehavior extends Behavior implements IMineBehavior, Helpe
addNearby();
}
updateGoal();
PathingBehavior.INSTANCE.revalidateGoal();
((PathingBehavior) baritone.getPathingBehavior()).revalidateGoal();
}
private void updateGoal() {
@ -93,7 +93,7 @@ public final class MineBehavior extends Behavior implements IMineBehavior, Helpe
if (!locs.isEmpty()) {
List<BlockPos> locs2 = prune(new ArrayList<>(locs), mining, 64);
// can't reassign locs, gotta make a new var locs2, because we use it in a lambda right here, and variables you use in a lambda must be effectively final
PathingBehavior.INSTANCE.setGoalAndPath(new GoalComposite(locs2.stream().map(loc -> coalesce(loc, locs2)).toArray(Goal[]::new)));
((PathingBehavior) baritone.getPathingBehavior()).setGoalAndPath(new GoalComposite(locs2.stream().map(loc -> coalesce(loc, locs2)).toArray(Goal[]::new)));
knownOreLocations = locs;
return;
}
@ -104,11 +104,11 @@ public final class MineBehavior extends Behavior implements IMineBehavior, Helpe
// only in non-Xray mode (aka legit mode) do we do this
if (branchPoint == null) {
int y = Baritone.settings().legitMineYLevel.get();
if (!PathingBehavior.INSTANCE.isPathing() && playerFeet().y == y) {
if (!baritone.getPathingBehavior().isPathing() && playerFeet().y == y) {
// cool, path is over and we are at desired y
branchPoint = playerFeet();
} else {
PathingBehavior.INSTANCE.setGoalAndPath(new GoalYLevel(y));
((PathingBehavior) baritone.getPathingBehavior()).setGoalAndPath(new GoalYLevel(y));
return;
}
}
@ -117,7 +117,7 @@ public final class MineBehavior extends Behavior implements IMineBehavior, Helpe
// TODO mine 1x1 shafts to either side
branchPoint = branchPoint.north(10);
}
PathingBehavior.INSTANCE.setGoalAndPath(new GoalBlock(branchPoint));
((PathingBehavior) baritone.getPathingBehavior()).setGoalAndPath(new GoalBlock(branchPoint));
}
private void rescan() {
@ -197,12 +197,12 @@ public final class MineBehavior extends Behavior implements IMineBehavior, Helpe
knownOreLocations = prune(knownOreLocations, mining, 64);
}
public static List<BlockPos> prune(List<BlockPos> locs2, List<Block> mining, int max) {
public List<BlockPos> prune(List<BlockPos> locs2, List<Block> mining, int max) {
List<BlockPos> locs = locs2
.stream()
// remove any that are within loaded chunks that aren't actually what we want
.filter(pos -> MineBehavior.INSTANCE.world().getChunk(pos) instanceof EmptyChunk || mining.contains(BlockStateInterface.get(pos).getBlock()))
.filter(pos -> world().getChunk(pos) instanceof EmptyChunk || mining.contains(BlockStateInterface.get(pos).getBlock()))
// remove any that are implausible to mine (encased in bedrock, or touching lava)
.filter(MineBehavior::plausibleToBreak)
@ -247,6 +247,6 @@ public final class MineBehavior extends Behavior implements IMineBehavior, Helpe
@Override
public void cancel() {
mine(0, (String[]) null);
PathingBehavior.INSTANCE.cancel();
baritone.getPathingBehavior().cancel();
}
}

View File

@ -46,8 +46,6 @@ import java.util.stream.Collectors;
public final class PathingBehavior extends Behavior implements IPathingBehavior, Helper {
public static final PathingBehavior INSTANCE = new PathingBehavior();
private PathExecutor current;
private PathExecutor next;
@ -62,7 +60,9 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
private final LinkedBlockingQueue<PathEvent> toDispatch = new LinkedBlockingQueue<>();
private PathingBehavior() {}
public PathingBehavior(Baritone baritone) {
super(baritone);
}
private void queuePathEvent(PathEvent event) {
toDispatch.add(event);

View File

@ -24,7 +24,6 @@ import baritone.api.utils.BetterBlockPos;
import baritone.api.utils.Rotation;
import baritone.api.utils.RotationUtils;
import baritone.api.utils.VecUtils;
import baritone.behavior.LookBehavior;
import baritone.utils.BlockBreakHelper;
import baritone.utils.BlockStateInterface;
import baritone.utils.Helper;
@ -126,7 +125,7 @@ public abstract class Movement implements IMovement, Helper, MovementHelper {
// If the movement target has to force the new rotations, or we aren't using silent move, then force the rotations
latestState.getTarget().getRotation().ifPresent(rotation ->
LookBehavior.INSTANCE.updateTarget(
Baritone.INSTANCE.getLookBehavior().updateTarget(
rotation,
latestState.getTarget().hasToForceRotations()));

View File

@ -17,11 +17,11 @@
package baritone.utils;
import baritone.Baritone;
import baritone.api.event.events.TickEvent;
import baritone.api.event.listener.AbstractGameEventListener;
import baritone.api.pathing.goals.Goal;
import baritone.api.pathing.goals.GoalBlock;
import baritone.behavior.PathingBehavior;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiMainMenu;
import net.minecraft.client.settings.GameSettings;
@ -105,8 +105,8 @@ public class BaritoneAutoTest implements AbstractGameEventListener, Helper {
}
// Setup Baritone's pathing goal and (if needed) begin pathing
PathingBehavior.INSTANCE.setGoal(GOAL);
PathingBehavior.INSTANCE.path();
Baritone.INSTANCE.getPathingBehavior().setGoal(GOAL);
Baritone.INSTANCE.getPathingBehavior().path();
// If we have reached our goal, print a message and safely close the game
if (GOAL.isInGoal(playerFeet())) {

View File

@ -26,7 +26,6 @@ import baritone.api.pathing.movement.ActionCosts;
import baritone.api.utils.RayTraceUtils;
import baritone.api.utils.SettingsUtil;
import baritone.behavior.Behavior;
import baritone.behavior.FollowBehavior;
import baritone.behavior.MineBehavior;
import baritone.behavior.PathingBehavior;
import baritone.cache.ChunkPacker;
@ -48,14 +47,8 @@ import java.util.stream.Stream;
public class ExampleBaritoneControl extends Behavior implements Helper {
public static ExampleBaritoneControl INSTANCE = new ExampleBaritoneControl();
private ExampleBaritoneControl() {
}
public void initAndRegister() {
Baritone.INSTANCE.registerBehavior(this);
public ExampleBaritoneControl(Baritone baritone) {
super(baritone);
}
@Override
@ -77,6 +70,7 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
public boolean runCommand(String msg0) {
String msg = msg0.toLowerCase(Locale.US).trim(); // don't reassign the argument LOL
PathingBehavior pathingBehavior = (PathingBehavior) baritone.getPathingBehavior();
List<Settings.Setting<Boolean>> toggleable = Baritone.settings().getAllValuesByType(Boolean.class);
for (Settings.Setting<Boolean> setting : toggleable) {
if (msg.equalsIgnoreCase(setting.getName())) {
@ -158,16 +152,16 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
logDirect("unable to parse integer " + ex);
return true;
}
PathingBehavior.INSTANCE.setGoal(goal);
pathingBehavior.setGoal(goal);
logDirect("Goal: " + goal);
return true;
}
if (msg.equals("path")) {
if (!PathingBehavior.INSTANCE.path()) {
if (PathingBehavior.INSTANCE.getGoal() == null) {
if (!pathingBehavior.path()) {
if (pathingBehavior.getGoal() == null) {
logDirect("No goal.");
} else {
if (PathingBehavior.INSTANCE.getGoal().isInGoal(playerFeet())) {
if (pathingBehavior.getGoal().isInGoal(playerFeet())) {
logDirect("Already in goal");
} else {
logDirect("Currently executing a path. Please cancel it first.");
@ -194,23 +188,23 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
return true;
}
if (msg.equals("axis")) {
PathingBehavior.INSTANCE.setGoal(new GoalAxis());
PathingBehavior.INSTANCE.path();
pathingBehavior.setGoal(new GoalAxis());
pathingBehavior.path();
return true;
}
if (msg.equals("cancel") || msg.equals("stop")) {
MineBehavior.INSTANCE.cancel();
FollowBehavior.INSTANCE.cancel();
PathingBehavior.INSTANCE.cancel();
baritone.getMineBehavior().cancel();
baritone.getFollowBehavior().cancel();
pathingBehavior.cancel();
logDirect("ok canceled");
return true;
}
if (msg.equals("forcecancel")) {
MineBehavior.INSTANCE.cancel();
FollowBehavior.INSTANCE.cancel();
PathingBehavior.INSTANCE.cancel();
baritone.getMineBehavior().cancel();
baritone.getFollowBehavior().cancel();
pathingBehavior.cancel();
AbstractNodeCostSearch.forceCancel();
PathingBehavior.INSTANCE.forceCancel();
pathingBehavior.forceCancel();
logDirect("ok force canceled");
return true;
}
@ -220,7 +214,7 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
return true;
}
if (msg.equals("invert")) {
Goal goal = PathingBehavior.INSTANCE.getGoal();
Goal goal = pathingBehavior.getGoal();
BlockPos runAwayFrom;
if (goal instanceof GoalXZ) {
runAwayFrom = new BlockPos(((GoalXZ) goal).getX(), 0, ((GoalXZ) goal).getZ());
@ -231,13 +225,13 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
logDirect("Inverting goal of player feet");
runAwayFrom = playerFeet();
}
PathingBehavior.INSTANCE.setGoal(new GoalRunAway(1, runAwayFrom) {
pathingBehavior.setGoal(new GoalRunAway(1, runAwayFrom) {
@Override
public boolean isInGoal(BlockPos pos) {
return false;
}
});
if (!PathingBehavior.INSTANCE.path()) {
if (!pathingBehavior.path()) {
logDirect("Currently executing a path. Please cancel it first.");
}
return true;
@ -259,7 +253,7 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
logDirect("Not found");
return true;
}
FollowBehavior.INSTANCE.follow(toFollow.get());
baritone.getFollowBehavior().follow(toFollow.get());
logDirect("Following " + toFollow.get());
return true;
}
@ -291,7 +285,7 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
int quantity = Integer.parseInt(blockTypes[1]);
Block block = ChunkPacker.stringToBlock(blockTypes[0]);
Objects.requireNonNull(block);
MineBehavior.INSTANCE.mine(quantity, block);
baritone.getMineBehavior().mine(quantity, block);
logDirect("Will mine " + quantity + " " + blockTypes[0]);
return true;
} catch (NumberFormatException | ArrayIndexOutOfBoundsException | NullPointerException ex) {}
@ -302,14 +296,14 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
}
}
MineBehavior.INSTANCE.mine(0, blockTypes);
baritone.getMineBehavior().mine(0, blockTypes);
logDirect("Started mining blocks of type " + Arrays.toString(blockTypes));
return true;
}
if (msg.startsWith("thisway")) {
try {
Goal goal = GoalXZ.fromDirection(playerFeetAsVec(), player().rotationYaw, Double.parseDouble(msg.substring(7).trim()));
PathingBehavior.INSTANCE.setGoal(goal);
pathingBehavior.setGoal(goal);
logDirect("Goal: " + goal);
} catch (NumberFormatException ex) {
logDirect("Error unable to parse '" + msg.substring(7).trim() + "' to a double.");
@ -378,13 +372,13 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
return true;
}
} else {
List<BlockPos> locs = MineBehavior.INSTANCE.searchWorld(Collections.singletonList(block), 64);
List<BlockPos> locs = ((MineBehavior) baritone.getMineBehavior()).searchWorld(Collections.singletonList(block), 64);
if (locs.isEmpty()) {
logDirect("No locations for " + mining + " known, cancelling");
return true;
}
PathingBehavior.INSTANCE.setGoal(new GoalComposite(locs.stream().map(GoalGetToBlock::new).toArray(Goal[]::new)));
PathingBehavior.INSTANCE.path();
pathingBehavior.setGoal(new GoalComposite(locs.stream().map(GoalGetToBlock::new).toArray(Goal[]::new)));
pathingBehavior.path();
return true;
}
} else {
@ -395,8 +389,8 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
}
}
Goal goal = new GoalBlock(waypoint.getLocation());
PathingBehavior.INSTANCE.setGoal(goal);
if (!PathingBehavior.INSTANCE.path() && !goal.isInGoal(playerFeet())) {
pathingBehavior.setGoal(goal);
if (!pathingBehavior.path() && !goal.isInGoal(playerFeet())) {
logDirect("Currently executing a path. Please cancel it first.");
}
return true;
@ -408,10 +402,10 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
// for some reason the default spawnpoint is underground sometimes
Goal goal = new GoalXZ(spawnPoint.getX(), spawnPoint.getZ());
logDirect("spawn not saved, defaulting to world spawn. set goal to " + goal);
PathingBehavior.INSTANCE.setGoal(goal);
pathingBehavior.setGoal(goal);
} else {
Goal goal = new GoalBlock(waypoint.getLocation());
PathingBehavior.INSTANCE.setGoal(goal);
pathingBehavior.setGoal(goal);
logDirect("Set goal to most recent bed " + goal);
}
return true;
@ -427,8 +421,8 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
logDirect("home not saved");
} else {
Goal goal = new GoalBlock(waypoint.getLocation());
PathingBehavior.INSTANCE.setGoal(goal);
PathingBehavior.INSTANCE.path();
pathingBehavior.setGoal(goal);
pathingBehavior.path();
logDirect("Going to saved home " + goal);
}
return true;
@ -451,7 +445,7 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
return true;
}
if (msg.equals("pause")) {
boolean enabled = PathingBehavior.INSTANCE.toggle();
boolean enabled = pathingBehavior.toggle();
logDirect("Pathing Behavior has " + (enabled ? "resumed" : "paused") + ".");
return true;
}