//前方有"//"符号的都是注解,为方便你修改参数,我会适当的加一些解释
//这里是只需要执行一次的指令,不需要放进命令方块
scoreboard objectives add major minecraft.used:minecraft.carrot_on_a_stick
scoreboard objectives add shoot minecraft.used:minecraft.bow
scoreboard objectives add check dummy
tag @s add shooter
//被添加了shooter标签的玩家才能触发各式箭种
//指令铺设好之后,要先用萝卜钓竿触发一次箭种切换才能使用箭种
//这里是第一套,第一条使用循环方块,之后全部使用连锁,后方的代码块同理
//这四条指令的作用是识别你当前的箭种并识别你的射击动作
execute as @e[tag=shooter,tag=fire_shooter] at @s if score @s shoot > @s check run tag @e[type=arrow,sort=nearest,limit=1] add fire_arrow
execute as @e[tag=shooter,tag=bomb_shooter] at @s if score @s shoot > @s check run tag @e[type=arrow,sort=nearest,limit=1] add bomb_arrow
execute as @e[tag=shooter,tag=summon_shooter] at @s if score @s shoot > @s check run tag @e[type=arrow,sort=nearest,limit=1] add summon_arrow
execute as @e[tag=shooter] at @s if score @s shoot > @s check store result score @s check run scoreboard players get @s shoot
//第二套,此处为火焰箭的指令
//二行distance决定烧伤范围,三行life决定箭的存在时间,五行Fire决定烧伤时间
execute as @e[tag=fire_arrow] at @s run particle minecraft:flame ~ ~ ~ 0.5 0.5 0.5 0.01 2 normal
execute as @e[tag=fire_arrow] at @s run tag @e[tag=!shooter,type=!arrow,tag=!fired,distance=..4] add fired
execute as @e[tag=fire_arrow,tag=!used] at @s run data merge entity @s {life:1150}
execute as @e[tag=fire_arrow,tag=!used] at @s run tag @s add used
execute as @e[tag=fired] at @s run data merge entity @s {Fire:60}
execute as @e[tag=fired] at @s run tag @s remove fired
//第三套,此处为爆破箭的指令
//范围与伤害效果我并没有细化,请见谅
execute as @e[tag=bomb_arrow] at @s run particle minecraft:firework ~ ~ ~ 0.25 0.25 0.25 0.01 10 normal
execute as @e[tag=bomb_arrow,nbt={inGround:1b}] at @s run tag @s add bomb
execute as @e[tag=bomb] at @s run summon tnt ~ ~ ~
execute as @e[tag=bomb] at @s run kill @s
//第四套,此处为召唤箭的指令
//life不多说,六行"~ ~ 0 2"中的2决定箭雨覆盖范围,七行"~ ~5 ~"中的5决定箭的生成高度
execute as @e[tag=summon_arrow] at @s run particle minecraft:witch ~ ~ ~ 0.5 0.5 0.5 0.01 2 normal
execute as @e[tag=summon_arrow,nbt={inGround:1b}] at @s run tag @s add summon
execute as @e[tag=summon] at @s run summon arrow ~ ~1 ~ {Tags:["magic_arrow"]}
execute as @e[tag=summon,tag=!used] at @s run data merge entity @s {life:1150}
execute as @e[tag=summon,tag=!used] at @s run tag @s add used
execute as @e[tag=magic_arrow,tag=!used,nbt={inGround:0b}] at @s run spreadplayers ~ ~ 0 2 false @s
execute as @e[tag=magic_arrow,tag=!used,nbt={inGround:0b}] at @s run tp @s ~ ~5 ~
execute as @e[tag=magic_arrow,tag=!used] at @s run data merge entity @s {life:1150}
execute as @e[tag=magic_arrow,tag=!used,nbt={inGround:0b}] at @s run tag @s add used
//最后四套都是控制切换功能的指令
//第五套,这条单独放一块循环
execute as @e[tag=shooter] at @s if score @s major matches 4 run scoreboard players set @s major 1
//第六套
execute as @e[tag=shooter,tag=!fire_shooter] at @s if score @s major matches 1 run title @s actionbar "火焰"
execute as @e[tag=shooter,tag=!fire_shooter] at @s if score @s major matches 1 run tag @s add fire_shooter
execute as @e[tag=shooter,tag=fire_shooter] at @s if score @s major matches 1 run tag @s remove summon_shooter
//第七套
execute as @e[tag=shooter,tag=!bomb_shooter] at @s if score @s major matches 2 run title @s actionbar "爆破"
execute as @e[tag=shooter,tag=!bomb_shooter] at @s if score @s major matches 2 run tag @s add bomb_shooter
execute as @e[tag=shooter,tag=bomb_shooter] at @s if score @s major matches 2 run tag @s remove fire_shooter
//第八套
execute as @e[tag=shooter,tag=!summon_shooter] at @s if score @s major matches 3 run title @s actionbar "召唤"
execute as @e[tag=shooter,tag=!summon_shooter] at @s if score @s major matches 3 run tag @s add summon_shooter
execute as @e[tag=shooter,tag=summon_shooter] at @s if score @s major matches 3 run tag @s remove bomb_shooter
|