give_equip.mcfunction 518 B

12345678910111213
  1. # 将无装备猪灵变为有装备猪灵
  2. tag @s remove empty_pig
  3. # 生成随机数
  4. scoreboard players set $random_min mem 1
  5. scoreboard players set $random_max mem 4
  6. function lib:random
  7. # 给予装备
  8. execute if score $random mem matches 1..2 run replaceitem entity @s weapon.mainhand minecraft:crossbow
  9. execute if score $random mem matches 3..4 run replaceitem entity @s weapon.mainhand minecraft:golden_sword
  10. execute if score $random mem matches 2..3 run replaceitem entity @s armor.legs minecraft:golden_leggings