From 6d1003de8f11807e0e291680b8c6a73a25b5cac3 Mon Sep 17 00:00:00 2001 From: zLauch <44842475+zLauch@users.noreply.github.com> Date: Tue, 28 Dec 2021 18:50:13 +0100 Subject: [PATCH] Create switchDim.sc --- switchDim.sc | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 switchDim.sc diff --git a/switchDim.sc b/switchDim.sc new file mode 100644 index 0000000..2e161d3 --- /dev/null +++ b/switchDim.sc @@ -0,0 +1,59 @@ +__config() -> { + 'stay_loaded' -> true, + 'commands' -> { + 'End' -> _() -> _gotoEnd();, + 'Overworld' -> _() ->_gotoOverworld();, + 'Nether' -> _() ->_gotoNether(); + } +}; + +_gotoEnd()->( + plr = player(); + if + (query(plr,'gamemode_id')==3, + ( + run('execute in the_end run tp '+plr+' 0 100 0'); + ), + _error(); + ); +); + +_gotoOverworld()->( + plr = player(); + if + (query(plr,'gamemode_id')==3, + if + (query(plr, 'dimension')=='the_nether', + ( + run('execute in overworld run tp '+plr+' '+round(query(plr,'x')/8)+' '+round(query(plr,'y'))+' '+round(query(plr,'z')/8)+''); + ), + _error2(); + );, + _error(); + ); +); + +_gotoNether()->( + plr = player(); + if + (query(plr,'gamemode_id')==3, + if + (query(plr, 'dimension')=='overworld', + ( + run('execute in the_nether run tp '+plr+' '+round(query(plr,'x')*8)+' '+round(query(plr,'y'))+' '+round(query(plr,'z')*8)+''); + ), + _error2(); + );, + _error(); + ); +); + +_error()->( + plr = player(); + run('tellraw '+plr+' ["",{"text":"You can only run this command when you are in spectator mode","color":"red"}]'); +); + +_error2()->( + plr = player(); + run('tellraw '+plr+' ["",{"text":"You can not switch to the Overworld or the Nether from the End.","color":"red"}]'); +);