fz-survival-datapack/scripts/here.sc

60 lines
1.7 KiB
Python
Raw Normal View History

2020-12-28 11:10:15 +08:00
__config() -> {
2021-09-16 23:52:32 +08:00
'stay_loaded' -> true,
'commands' -> {
'' -> 'my_pos',
'<player>' -> 'print_pos'
},
'arguments' -> {
'player' -> {
'type' -> 'players'
},
}
2020-12-28 11:10:15 +08:00
};
__command() -> (
s_player = player();
pos = query(s_player, 'pos');
dim = query(s_player, 'dimension');
2021-07-03 06:21:34 +08:00
if(dim == 'overworld',
(
run(str('tellraw @a [{"selector": "@s"},{"text":"说: 我在主世界[x:%d, y:%d, z:%d, dim:overworld]","color": "aqua"}]',
round(pos:0), round(pos:1), round(pos:2)
));
run(str('tellraw @a [{"text":"- 对应地狱: [x:%d, y:128, z:%d, dim:the_nether]","color": "aqua"}]',
round((pos:0)/8), round((pos:2)/8)
))
),
dim == 'the_nether',
(
run(str('tellraw @a [{"selector": "@s"},{"text":"说: 我在下界[x:%d, y:%d, z:%d, dim:the_nether]","color": "aqua"}]',
round(pos:0), round(pos:1), round(pos:2)
));
run(str('tellraw @a [{"text":"- 对应主世界: [x:%d, y:64, z:%d, dim:overworld]","color": "aqua"}]',
round((pos:0)*8), round((pos:2)*8)
))
),
dim == 'the_end',
(
run(str('tellraw @a [{"selector": "@s"},{"text":"说: 我在末地[x:%d, y:%d, z:%d, dim:%s]","color": "aqua"}]',
round(pos:0), round(pos:1), round(pos:2), dim
))
),
run(str('tellraw @a [{"selector": "@s"},{"text":"说: 我在%s世界[x:%d, y:%d, z:%d, dim:%s]","color": "aqua"}]',
dim, round(pos:0), round(pos:1), round(pos:2), dim
))
);
2020-12-28 11:10:15 +08:00
exit()
2021-09-16 23:52:32 +08:00
);
print_pos(request_player) -> (
name = request_player ~ 'name';
pos = query(request_player, 'pos');
dim = query(request_player, 'dimension');
if(dim == 'overworld',
o_dim = '主世界';
run('say ' + name + ' 在主世界的 [x:' + pos:0 + ',y:' + pos:1 + ',z:' + pos:2 + ']向你说话'))
);
my_pos() -> (
print_pos(player())
);