我想刷出一个名字 叫做 "分数:(实体@s在计分板1的分数)"的tnt
summon minecraft:tnt ^ ~ ^ {CustomName:"{\"text\":\"\",\"extra\":[{\"text\":\"分数:\"},{\"score\":{\"name\":\"@s\",\"objective\":\"1\"}}]}"}
但是只显示 "分数:" 我想问问出什么错误=w=
2021.12 数据,可能有更多内容
我想刷出一个名字 叫做 "分数:(实体@s在计分板1的分数)"的tnt
summon minecraft:tnt ^ ~ ^ {CustomName:"{\"text\":\"\",\"extra\":[{\"text\":\"分数:\"},{\"score\":{\"name\":\"@s\",\"objective\":\"1\"}}]}"}
但是只显示 "分数:"我想问问出什么错误=w=
【308】
实体 CustomName 并不能使用 score,该问题在 1.13.2 下无简单解,但在目前最新版 1.14 Pre-Release 2 中有较为方便的办法,如有意更换到新版本可以追问解决办法【跑
另外,局部坐标(~)和本地坐标(^)不能混合使用。
在 1.13.2 中的复杂解决办法:
execute as @e[type=tnt] if score @s 1 matches 0 run data merge entity @s {CustomName:"[{\"text\":\"分数:\"},\"0\"]"}
execute as @e[type=tnt] if score @s 1 matches 1 run data merge entity @s {CustomName:"[{\"text\":\"分数:\"},\"1\"]"}
execute as @e[type=tnt] if score @s 1 matches 2 run data merge entity @s {CustomName:"[{\"text\":\"分数:\"},\"2\"]"}
execute as @e[type=tnt] if score @s 1 matches 3 run data merge entity @s {CustomName:"[{\"text\":\"分数:\"},\"3\"]"}
execute as @e[type=tnt] if score @s 1 matches 4 run data merge entity @s {CustomName:"[{\"text\":\"分数:\"},\"4\"]"}
execute as @e[type=tnt] if score @s 1 matches 5 run data merge entity @s {CustomName:"[{\"text\":\"分数:\"},\"5\"]"}
...
实体 CustomName 并不能使用 score,该问题在 1.13.2 下无简单解,但在目前最新版 1.14 Pre-Release 2 中有较为方便的办法,如有意更换到新版本可以追问解决办法【跑
另外,局部坐标(~)和本地坐标(^)不能混合使用。
在 1.13.2 中的复杂解决办法:
execute as @e[type=tnt] if score @s 1 matches 0 run data merge entity @s {CustomName:"[{\"text\":\"分数:\"},\"0\"]"}
execute as @e[type=tnt] if score @s 1 matches 1 run data merge entity @s {CustomName:"[{\"text\":\"分数:\"},\"1\"]"}
execute as @e[type=tnt] if score @s 1 matches 2 run data merge entity @s {CustomName:"[{\"text\":\"分数:\"},\"2\"]"}
execute as @e[type=tnt] if score @s 1 matches 3 run data merge entity @s {CustomName:"[{\"text\":\"分数:\"},\"3\"]"}
execute as @e[type=tnt] if score @s 1 matches 4 run data merge entity @s {CustomName:"[{\"text\":\"分数:\"},\"4\"]"}
execute as @e[type=tnt] if score @s 1 matches 5 run data merge entity @s {CustomName:"[{\"text\":\"分数:\"},\"5\"]"}
...
好吧,还是谢谢了qwq