invert goal to run away
This commit is contained in:
parent
342bb8616c
commit
fdf11f9d76
@ -176,6 +176,10 @@ public class PathingBehavior extends Behavior {
|
||||
this.goal = goal;
|
||||
}
|
||||
|
||||
public Goal getGoal() {
|
||||
return goal;
|
||||
}
|
||||
|
||||
public PathExecutor getCurrent() {
|
||||
return current;
|
||||
}
|
||||
|
@ -109,6 +109,28 @@ public class ExampleBaritoneControl extends Behavior {
|
||||
displayChatMessageRaw("ok canceled");
|
||||
return;
|
||||
}
|
||||
if (msg.toLowerCase().equals("invert")) {
|
||||
Goal goal = PathingBehavior.INSTANCE.getGoal();
|
||||
BlockPos runAwayFrom;
|
||||
if (goal instanceof GoalXZ) {
|
||||
runAwayFrom = new BlockPos(((GoalXZ) goal).getX(), 0, ((GoalXZ) goal).getZ());
|
||||
} else if (goal instanceof GoalBlock) {
|
||||
runAwayFrom = ((GoalBlock) goal).getGoalPos();
|
||||
} else {
|
||||
displayChatMessageRaw("Goal must be GoalXZ or GoalBlock to invert");
|
||||
displayChatMessageRaw("Inverting goal of player feet");
|
||||
runAwayFrom = playerFeet();
|
||||
}
|
||||
PathingBehavior.INSTANCE.setGoal(new GoalRunAway(1, runAwayFrom) {
|
||||
@Override
|
||||
public boolean isInGoal(BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
PathingBehavior.INSTANCE.path();
|
||||
event.cancel();
|
||||
return;
|
||||
}
|
||||
if (msg.toLowerCase().equals("reloadall")) {
|
||||
WorldProvider.INSTANCE.getCurrentWorld().cache.reloadAllFromDisk();
|
||||
displayChatMessageRaw("ok");
|
||||
|
Loading…
Reference in New Issue
Block a user