在写函数文件时,往往会使用大量的目标选择器,并伴随着多个判断条件,更有甚者还会在数据包中对其每刻执行。
随着目标选择器使用的数量越来越多,性能问题也愈发明显,拆分成多个函数文件又会使得函数文件繁多且杂乱。
因此,我建议在函数文件中的"/execute"指令增一个特性,即允许玩家只使用一个目标选择器,从而允许多个函数在一个代码块内执行,其执行位置和执行者由"/execute"函数进行指定,其语法如下:
#.mcfunction file only
# example : @e[...] -> sheep
execute as @e[...] at @s run {
# do something... ( executor : sheep | location : sheep )
}
Please sign in to leave a comment.
0 Comments