summon_new_rule.mcfunction 1.4 KB

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