如题,如何检测玩家是趴着的状态
本帖最后由 Muggle2077 于 2022-9-7 18:41 编辑
I
检测身高。
复制代码
II
检测玩家上方是否被方块或实体阻挡。
两种方法都有一定的漏洞,具体表现在玩家游泳/使用鞘翅飞行时。
I
检测身高。
- execute as @a at @s positioned ~ ~1.79 ~ if entity @s[dx=0,dy=0,dz=0] run say 站着
- execute as @a at @s positioned ~ ~1.49 ~ if entity @s[dx=0,dy=0,dz=0] positioned ~ ~0.3 ~ unless entity @s[dx=0,dy=0,dz=0] run say 蹲着
- execute as @a at @s positioned ~ ~1.49 ~ unless entity @s[dx=0,dy=0,dz=0] run say 趴着
II
检测玩家上方是否被方块或实体阻挡。
两种方法都有一定的漏洞,具体表现在玩家游泳/使用鞘翅飞行时。
玩家有三种姿势:站立、潜行、游泳,其中,在一格高的空间内、在水下游泳时、用鞘翅飞行时,姿势都是游泳。