home and sethome, fixes #54
This commit is contained in:
parent
dab70926e2
commit
4bf1c79830
@ -21,6 +21,8 @@ import baritone.Baritone;
|
|||||||
import baritone.Settings;
|
import baritone.Settings;
|
||||||
import baritone.behavior.Behavior;
|
import baritone.behavior.Behavior;
|
||||||
import baritone.behavior.impl.PathingBehavior;
|
import baritone.behavior.impl.PathingBehavior;
|
||||||
|
import baritone.chunk.Waypoint;
|
||||||
|
import baritone.chunk.WorldProvider;
|
||||||
import baritone.event.events.ChatEvent;
|
import baritone.event.events.ChatEvent;
|
||||||
import baritone.pathing.calc.AStarPathFinder;
|
import baritone.pathing.calc.AStarPathFinder;
|
||||||
import baritone.pathing.goals.Goal;
|
import baritone.pathing.goals.Goal;
|
||||||
@ -122,6 +124,24 @@ public class ExampleBaritoneControl extends Behavior {
|
|||||||
event.cancel();
|
event.cancel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (msg.toLowerCase().equals("sethome")) {
|
||||||
|
WorldProvider.INSTANCE.getCurrentWorld().waypoints.addWaypoint(new Waypoint("", Waypoint.Tag.HOME, playerFeet()));
|
||||||
|
displayChatMessageRaw("Saved. Say home to set goal.");
|
||||||
|
event.cancel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (msg.toLowerCase().equals("home")) {
|
||||||
|
Waypoint waypoint = WorldProvider.INSTANCE.getCurrentWorld().waypoints.getMostRecentByTag(Waypoint.Tag.HOME);
|
||||||
|
if (waypoint == null) {
|
||||||
|
displayChatMessageRaw("home not saved");
|
||||||
|
} else {
|
||||||
|
Goal goal = new GoalBlock(waypoint.location);
|
||||||
|
PathingBehavior.INSTANCE.setGoal(goal);
|
||||||
|
displayChatMessageRaw("Set goal to " + goal);
|
||||||
|
}
|
||||||
|
event.cancel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (msg.toLowerCase().equals("costs")) {
|
if (msg.toLowerCase().equals("costs")) {
|
||||||
Movement[] movements = AStarPathFinder.getConnectedPositions(new BetterBlockPos(playerFeet()), new CalculationContext());
|
Movement[] movements = AStarPathFinder.getConnectedPositions(new BetterBlockPos(playerFeet()), new CalculationContext());
|
||||||
ArrayList<Movement> moves = new ArrayList<>(Arrays.asList(movements));
|
ArrayList<Movement> moves = new ArrayList<>(Arrays.asList(movements));
|
||||||
|
Loading…
Reference in New Issue
Block a user