召唤boss的指令
/summon minecraft:zombie ~ ~1 ~ {Tags:["boss"],Health:25.0,Attributes:[{Name:"generic.maxHealth",Base:25}],HandItems:[{id:"minecraft:iron_sword",Count:1b,tag:{Unbreakable:1b,Enchantments:[{}]}},{}],ArmorItems:[{id:"minecraft:netherite_boots",Count:1b,tag:{Enchantments:[{id:"minecraft:protection",lvl:20s}]}},{id:"minecraft:netherite_leggings",Count:1b,tag:{Enchantments:[{id:"minecraft:protection",lvl:20s}]}},{id:"minecraft:netherite_chestplate",Count:1b,tag:{Enchantments:[{id:"minecraft:protection",lvl:20s}]}},{id:"minecraft:netherite_helmet",Count:1b,tag:{Enchantments:[{id:"minecraft:protection",lvl:20s}]}}]}
bossbar的指令
/execute store result bossbar zombie value run data get entity @e[type=zombie,tag=boss,limit=1] Health
/bossbar set boss:zombie max 20
 
 
/summon minecraft:zombie ~ ~1 ~ {Tags:["boss"],Health:25.0,Attributes:[{Name:"generic.maxHealth",Base:25}],HandItems:[{id:"minecraft:iron_sword",Count:1b,tag:{Unbreakable:1b,Enchantments:[{}]}},{}],ArmorItems:[{id:"minecraft:netherite_boots",Count:1b,tag:{Enchantments:[{id:"minecraft:protection",lvl:20s}]}},{id:"minecraft:netherite_leggings",Count:1b,tag:{Enchantments:[{id:"minecraft:protection",lvl:20s}]}},{id:"minecraft:netherite_chestplate",Count:1b,tag:{Enchantments:[{id:"minecraft:protection",lvl:20s}]}},{id:"minecraft:netherite_helmet",Count:1b,tag:{Enchantments:[{id:"minecraft:protection",lvl:20s}]}}]}
bossbar的指令
/execute store result bossbar zombie value run data get entity @e[type=zombie,tag=boss,limit=1] Health
/bossbar set boss:zombie max 20
没用,怎么回事
 本帖最后由 Muggle2077 于 2022-7-27 15:27 编辑 
execute store result bossbar zombie value run data get entity @e[type=zombie,tag=boss,limit=1] Health
bossbar set boss:zombie max 20
两个 bossbar 的 id 不一样。
另外,注意到下界合金装备,推测版本 1.16+,generic.maxHealth 应该改为 generic.max_health。
execute store result bossbar zombie value run data get entity @e[type=zombie,tag=boss,limit=1] Health
bossbar set boss:zombie max 20
两个 bossbar 的 id 不一样。
另外,注意到下界合金装备,推测版本 1.16+,generic.maxHealth 应该改为 generic.max_health。