发布网友 发布时间:2022-04-24 18:39
共1个回答
热心网友 时间:2023-11-02 18:31
这个容易,先说一下具体思路吧:
首先创建一个计时的记分板,用来加时间
然后检测,如果时间到了,就将是建设为零重新计时,并且调用粒子效果的指令在玩家头上冒出爱心。
指令:(直接放到一个命令方块里然后启动就行)(必须是1.13+的版本)
summon minecraft:falling_block ~ ~1 ~ {BlockState:{Name:"minecraft:redstone_block"},Time:1,Passengers:[{id:"minecraft:pig",Health:0f,Passengers:[{id:"minecraft:falling_block",Time:1,BlockState:{Name:"minecraft:activator_rail"},Passengers:[{id:"minecraft:command_block_minecart",Command:"/gamerule commandBlockOutput false"},{id:"command_block_minecart",Command:'setblock ~ ~2 ~ command_block[facing=up,conditional=false]{auto:1,Command:"scoreboard objectives add time mmy"}'},{id:"command_block_minecart",Command:'setblock ~ ~3 ~ repeating_command_block[facing=up,conditional=false]{auto:1,Command:"scoreboard players add tick time 1"}'},{id:"command_block_minecart",Command:'setblock ~ ~4 ~ chain_command_block[facing=up,conditional=false]{auto:1,Command:"execute if score tick time matches 20.. run scoreboard players add s time 1"}'},{id:"command_block_minecart",Command:'setblock ~ ~5 ~ chain_command_block[facing=up,conditional=false]{auto:1,Command:"execute if score tick time matches 20.. run scoreboard players set tick time 0"}'},{id:"command_block_minecart",Command:'setblock ~ ~6 ~ chain_command_block[facing=up,conditional=false]{auto:1,Command:"execute as @a at @s if score s time matches 30..35 run particle heart ~ ~2 ~ 0.1 0.1 0.1 0.1 30 force @a"}'},{id:"command_block_minecart",Command:'setblock ~ ~7 ~ chain_command_block[facing=up,conditional=false]{auto:1,Command:"execute if score s time matches 36.. run scoreboard players set s time 0"}'},{id:"command_block_minecart",Command:'setblock ~ ~-2 ~ repeating_command_block{auto:1,Command:"fill ~ ~ ~ ~ ~2 ~ air"}'},{id:"command_block_minecart",Command:"kill @e[type=command_block_minecart,distance=..1]"}]}]}]}
这个直接塞到命令方块中然后启动就行了,会自动生成,注意一定要在空旷的地方。
这个是计时,当到了30秒之后,头上会出现爱心,持续5秒,然后再过30秒在持续五秒以此类推.
加粗字体的地方时可以改动的,第一个30..35是设置持续的时间,这个和后面的36..相匹配,如果我想在第40秒出现爱心,持续10秒,则应该改为40..50,后面的匹配改为51..
~ ~2 ~ 是代表的位置,~2是在头顶上。
0.1 0.1 0.1 是代表的范围,就是粒子效果在一定范围内显示。
30是密度,即每运行一次这个命令出现的爱心数量。指令1秒20次