无权限即可使用的伪tp指令

By MAVerICk    2019/02/02

使用/trigger设置相应分数值来代替tp的X Y Z。在1.13版本之前需要用到二分法来实现,而在1.13之后只需要将相应分数导至marker的Pos中即可。

使用方法依次trigger tp_X tp_Y tp_Z三个计分板为你想去的坐标:比如我想去666 66 -666,那么我就需要输入,trigger tp_X set 666trigger tp_Y set 66trigger tp_Z set -666,输入完毕以后输入,trigger tp_done,即可完成tp。

效果图:

tp效果图

GIF中的trigger tp_done set 1其实是比较复杂的写法,1.13+开始 trigger tp_done默认就是 trigger tp_done add 1的简写,事实上,只要tp_done分数大于1即可触发tp所以可以直接使用 trigger tp_done来触发,在触发tp_done之前一定要先触发tp_X Y Z这三个,不然默认传送到0 0 0。



原理

新建四个trigger计分板,名称分别为tp_X tp_Y tp_Z tp_done,对每个人都启用。

检测是否有玩家tp_done分数大于1,若有,则在玩家坐标生成一个marker,随后利用 execute store分别记录玩家的tp_X tp_Y tp_Z分数到marker的Pos中,接下来只需要把玩家tp到该marker,并且清除该marker即可,也可以用tellraw美化一下,最后reset玩家的分数。



代码

  1. execute as @a[scores={tp_done=1..}] at @s run summon minecraft:area_effect_cloud ~ ~ ~ {Duration:2147483647,Tags:["teleport"]}
  2. execute as @a[scores={tp_done=1..}] at @s store result entity @e[type=minecraft:area_effect_cloud,tag=teleport,sort=nearest,limit=1] Pos.[0] double 1 run scoreboard players get @s tp_X
  3. execute as @a[scores={tp_done=1..}] at @s store result entity @e[type=minecraft:area_effect_cloud,tag=teleport,sort=nearest,limit=1] Pos.[1] double 1 run scoreboard players get @s tp_Y
  4. execute as @a[scores={tp_done=1..}] at @s store result entity @e[type=minecraft:area_effect_cloud,tag=teleport,sort=nearest,limit=1] Pos.[2] double 1 run scoreboard players get @s tp_Z
  5. tp @a[scores={tp_done=1..}] @e[type=minecraft:area_effect_cloud,tag=teleport,limit=1]
  6. execute as @a[scores={tp_done=1..}] run tellraw @s [{"text":"将"},{"selector":"@s"},{"text":"传送到 "},{"score":{"objective":"tp_X","name":"@s"}},{"text":","},{"score":{"objective":"tp_Y","name":"@s"}},{"text":","},{"score":{"objective":"tp_Z","name":"@s"}}]
  7. execute as @a[scores={tp_done=1..}] run kill @e[type=minecraft:area_effect_cloud,tag=teleport]
  8. execute as @a[scores={tp_done=1..}] run scoreboard players reset @a tp_X
  9. execute as @a[scores={tp_done=1..}] run scoreboard players reset @a tp_Y
  10. execute as @a[scores={tp_done=1..}] run scoreboard players reset @a tp_Z
  11. execute as @a[scores={tp_done=1..}] run scoreboard players reset @a tp_done


数据包

下载链接:http://www.ganxiaozhe.com/mc/mljc/dl/20190202000.zip

  • 使用方法 - 在你需要安装数据包的存档目录下的datapacks文件夹内放置数据包(记得解压)。如果游戏正打开着该存档,则输入指令/reload或者退出存档重新进入;如果游戏没有打开该存档,直接进入游戏即可,数据包会自动安装载入。




『关于在1.13之前实现伪tp指令可见』

LOADING | 此框架正在加载中
QQ群:771363745