bed
This commit is contained in:
parent
4bf1c79830
commit
fcb947bedc
@ -62,7 +62,7 @@ public class Waypoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public enum Tag {
|
public enum Tag {
|
||||||
HOME, DEATH, USER;
|
HOME, DEATH, BED, USER;
|
||||||
|
|
||||||
{
|
{
|
||||||
map.put(name().toLowerCase(), this);
|
map.put(name().toLowerCase(), this);
|
||||||
|
@ -115,12 +115,19 @@ public class ExampleBaritoneControl extends Behavior {
|
|||||||
event.cancel();
|
event.cancel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (msg.toLowerCase().equals("spawn")) {
|
if (msg.toLowerCase().equals("spawn") || msg.toLowerCase().equals("bed")) {
|
||||||
|
Waypoint waypoint = WorldProvider.INSTANCE.getCurrentWorld().waypoints.getMostRecentByTag(Waypoint.Tag.BED);
|
||||||
|
if (waypoint == null) {
|
||||||
BlockPos spawnPoint = player().getBedLocation();
|
BlockPos spawnPoint = player().getBedLocation();
|
||||||
// for some reason the default spawnpoint is underground sometimes
|
// for some reason the default spawnpoint is underground sometimes
|
||||||
Goal goal = new GoalXZ(spawnPoint.getX(), spawnPoint.getY());
|
Goal goal = new GoalXZ(spawnPoint.getX(), spawnPoint.getZ());
|
||||||
|
displayChatMessageRaw("spawn not saved, defaulting to world spawn. set goal to " + goal);
|
||||||
PathingBehavior.INSTANCE.setGoal(goal);
|
PathingBehavior.INSTANCE.setGoal(goal);
|
||||||
displayChatMessageRaw("Goal: " + goal);
|
} else {
|
||||||
|
Goal goal = new GoalBlock(waypoint.location);
|
||||||
|
PathingBehavior.INSTANCE.setGoal(goal);
|
||||||
|
displayChatMessageRaw("Set goal to most recent bed " + goal);
|
||||||
|
}
|
||||||
event.cancel();
|
event.cancel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -137,7 +144,7 @@ public class ExampleBaritoneControl extends Behavior {
|
|||||||
} else {
|
} else {
|
||||||
Goal goal = new GoalBlock(waypoint.location);
|
Goal goal = new GoalBlock(waypoint.location);
|
||||||
PathingBehavior.INSTANCE.setGoal(goal);
|
PathingBehavior.INSTANCE.setGoal(goal);
|
||||||
displayChatMessageRaw("Set goal to " + goal);
|
displayChatMessageRaw("Set goal to saved home " + goal);
|
||||||
}
|
}
|
||||||
event.cancel();
|
event.cancel();
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user