如题。判断玩家的手持物品是否满足#namespace:id
已尝试@a[nbt={SelectedItem:{id:"#namespace:id"}}]和execute if data entity @s SelectedItem{id:"#namespace:id"}均无效
已尝试@a[nbt={SelectedItem:{id:"#namespace:id"}}]和execute if data entity @s SelectedItem{id:"#namespace:id"}均无效
本帖最后由 晴路卡 于 2021-2-13 17:10 编辑
默认你是最新正式版哈 下次报个版本
写个断言:复制代码测试用数据包(不需要解压):
test.zip
(638 Bytes, 下载次数: 1)
测试指令:
复制代码
效果:当玩家拿着任何一种树叶的时候执行/say 1
标签可以换成其他自定义的
参考页面:
https://zhangshenxing.gitee.io/vanillamodtutorial/#%E6%88%98%E5%88%A9%E5%93%81%E8%A1%A8%E8%B0%93%E8%AF%8D
https://www.mcbbs.net/thread-914817-1-4.html
https://minecraft-zh.gamepedia.com/%E6%88%98%E5%88%A9%E5%93%81%E8%A1%A8%E8%B0%93%E8%AF%8D
默认你是最新正式版哈 下次报个版本
写个断言:
- {
- "condition": "minecraft:entity_properties",
- "entity": "this",
- "predicate": {
- "equipment": {
- "mainhand": {
- "tag": "minecraft:leaves"
- }
- }
- }
- }
测试指令:
- /execute as @a if predicate test:test run say 1
效果:当玩家拿着任何一种树叶的时候执行/say 1
标签可以换成其他自定义的
参考页面:
https://zhangshenxing.gitee.io/vanillamodtutorial/#%E6%88%98%E5%88%A9%E5%93%81%E8%A1%A8%E8%B0%93%E8%AF%8D
https://www.mcbbs.net/thread-914817-1-4.html
https://minecraft-zh.gamepedia.com/%E6%88%98%E5%88%A9%E5%93%81%E8%A1%A8%E8%B0%93%E8%AF%8D