summon_new_rule.mcfunction 1.4 KB

12345678910111213141516171819202122
  1. # at new position
  2. # input: $rgb_rule_type rgb_sys
  3. execute if score $rgb_rule_type rgb_sys matches 1 run loot replace block 0 0 1 container.0 loot mini:rgb/red
  4. execute if score $rgb_rule_type rgb_sys matches 2 run loot replace block 0 0 1 container.0 loot mini:rgb/green
  5. #execute if score $rgb_rule_type rgb_sys matches 3 run loot replace block 0 0 1 container.0 loot mini:rgb/blue
  6. #execute if score $rgb_rule_type rgb_sys matches 4 run loot replace block 0 0 1 container.0 loot mini:rgb/event
  7. execute if score $rgb_rule_type rgb_sys matches 5 run loot replace block 0 0 1 container.0 loot mini:rgb/finish
  8. # 生成文本
  9. data modify storage ltw:mini rgb.rule set from block 0 0 1 Items[0].tag
  10. setblock 0 1 0 acacia_wall_sign destroy
  11. function mini:rgb/game/gen_rule_text_1
  12. data modify block 0 1 0 Text1 set value '[{"nbt":"Text1","block":"0 1 0","interpret":true},{"text":" -> ","color":"white"}]'
  13. function mini:rgb/game/gen_rule_text_2
  14. # 生成实体
  15. summon armor_stand ~ ~ ~ {Tags:["rgb_new_rule"],Small:1b,ArmorItems:[{id:"minecraft:stone",Count:1b},{}],CustomNameVisible:1b}
  16. data modify entity @e[tag=rgb_new_rule,limit=1] CustomName set from block 0 1 0 Text1
  17. data modify entity @e[tag=rgb_new_rule,limit=1] ArmorItems[0].tag.conditions set from block 0 0 1 Items[0].tag.conditions
  18. data modify entity @e[tag=rgb_new_rule,limit=1] ArmorItems[0].tag.events set from block 0 0 1 Items[0].tag.events
  19. execute as @e[tag=rgb_new_rule] run function mini:rgb/game/add_rule