add dimension to waypoints
This commit is contained in:
parent
e33bd95b6a
commit
b67cb8ec3a
1 changed files with 5 additions and 1 deletions
|
|
@ -92,7 +92,7 @@
|
|||
if (!data[name]) {
|
||||
data[name] = {};
|
||||
}
|
||||
data[name][waypointId] = [pos.x,pos.y,pos.z];
|
||||
data[name][waypointId] = [pos.x,pos.y,pos.z,e.sender.dimension];
|
||||
saveData();
|
||||
e.sender.addChatMessage(ModAPI.reflect.getClassById("net.minecraft.util.ChatComponentText").constructors[0](ModAPI.util.str("Set waypoint "+waypointId+".")));
|
||||
}
|
||||
|
|
@ -103,6 +103,10 @@
|
|||
if (waypointId && Array.isArray(data?.[name]?.[waypointId])) {
|
||||
|
||||
// Wildly important! regular setPosition triggers minecraft's built in anti-cheat and teleports you back in the same tick.
|
||||
if (data?.[name]?.[waypointId]?.[3] && (data?.[name]?.[waypointId]?.[3] !== e.sender.dimension)) {
|
||||
e.sender.travelToDimension(data?.[name]?.[waypointId]?.[3]);
|
||||
}
|
||||
|
||||
e.sender.setPositionAndUpdate(...data?.[name]?.[waypointId]);
|
||||
|
||||
e.sender.addChatMessage(ModAPI.reflect.getClassById("net.minecraft.util.ChatComponentText").constructors[0](ModAPI.util.str("Teleported to waypoint " + waypointId + ".")));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue