IgnorantSky
本帖最后由 sky_flying 于 2021-7-11 10:19 编辑

怎么让使用局部坐标传送不会传送到墙中

具体效果:触发指令后,传送到视角方向5格前,若第五格被阻挡则只移动4格(以此类推)类似位移
目前指令:execute as @a at @s rotated ~ 0 positioned ^ ^ ^1 run tp ~ ~ ~






鱼宝放心飞
execute if block ^ ^ ^5 air run tp @s ^ ^ ^5


先用 execute 命令判断一下有没有墙。


【教程】[1.15] execute 命令入门教程
https://www.mcbbs.net/thread-989501-1-1.html

IgnorantSky
鱼宝放心飞 发表于 2021-7-11 10:18
execute if block ^ ^ ^5 air run tp @s ^ ^ ^5

这样貌似会穿墙

鱼宝放心飞

# 那就多来几个。
execute if block ^ ^ ^1 air if block ^ ^ ^2 air if block ^ ^ ^3 air if block ^ ^ ^4 air if block ^ ^ ^5 air run tp @s ^ ^ ^5
execute if block ^ ^ ^1 air if block ^ ^ ^2 air if block ^ ^ ^3 air if block ^ ^ ^4 air unless block ^ ^ ^5 air run tp @s ^ ^ ^4
execute if block ^ ^ ^1 air if block ^ ^ ^2 air if block ^ ^ ^3 air unless block ^ ^ ^4 air run tp @s ^ ^ ^3
execute if block ^ ^ ^1 air if block ^ ^ ^2 air unless block ^ ^ ^3 air run tp @s ^ ^ ^2
execute if block ^ ^ ^1 air unless block ^ ^ ^2 air run tp @s ^ ^ ^1

IgnorantSky
鱼宝放心飞 发表于 2021-7-11 10:20
# 那就多来几个。
execute if block ^ ^ ^1 air if block ^ ^ ^2 air if block ^ ^ ^3 air if block ^ ^ ^ ...

配合rotated进行视角矫正后还是会穿墙?

chixvv
一格一格地tp,执行五次
execute as @a at @s rotated ~ 0 positioned ^ ^ ^1  if block ~ ~ ~ air run tp ~ ~ ~
execute as @a at @s rotated ~ 0 positioned ^ ^ ^1  if block ~ ~ ~ air run tp ~ ~ ~
execute as @a at @s rotated ~ 0 positioned ^ ^ ^1  if block ~ ~ ~ air run tp ~ ~ ~
execute as @a at @s rotated ~ 0 positioned ^ ^ ^1  if block ~ ~ ~ air run tp ~ ~ ~
execute as @a at @s rotated ~ 0 positioned ^ ^ ^1  if block ~ ~ ~ air run tp ~ ~ ~

或许可以先让一个别的实体试一试有没有墙:
summon 一个实体A ~ ~ ~
summon 实体B ^ ^ ^5
让 实体A 的 Motion[0] = 实体B的Pos[0] - 实体A的Pos[0]
让 实体A 的 Motion[2] = 实体B的Pos[2] - 实体A的Pos[2]
等待一游戏刻后,再执行:tp 玩家 实体A

usvbar
能给个服务器的ip地址嘛 想换个服务器玩玩