Skip to content

Commit

Permalink
Create switchDim.sc
Browse files Browse the repository at this point in the history
  • Loading branch information
zLauch authored Dec 28, 2021
1 parent 6a63840 commit 6d1003d
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions switchDim.sc
Original file line number Diff line number Diff line change
@@ -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"}]');
);

0 comments on commit 6d1003d

Please sign in to comment.