Create a glowing swarm of ambient fireflies that gently drift, blink, and flutter around an enchanted forest lantern in Minecraft Java Edition.
Trails & PathsNatureYellowGreenOrangeDecorationMap MakingArmor standsSummoned mobsBlock building (fill/setblock/clone)Rotation math21+ commands
Despite how atmospheric Minecraft nights can be, forests and swamps often feel a bit empty once the sun goes down. With a handful of command blocks, you can populate any area with a living swarm of glowing fireflies that drift through the air, pulse with warm yellow-green light, and leave trailing sparks behind them.
This setup uses invisible wandering bats to give the fireflies natural, unpredictable flight paths, combined with an invisible orbit system and custom colour-shifting dust particles that glow brightly against the dark.
/scoreboard objectives add c9_timer dummy/fill ~-2 ~-1 ~-2 ~2 ~-1 ~2 moss_block/setblock ~ ~ ~ cobblestone_wall/setblock ~ ~1 ~ oak_fence/setblock ~ ~2 ~ lantern[hanging=false]/summon armor_stand ~ ~1 ~ {Invisible:1b,NoGravity:1b,Marker:1b,Tags:["c9_center"]}/summon bat ~2 ~2 ~1 {Silent:1b,NoAI:0b,PersistenceRequired:1b,Tags:["c9_fly","c9_f1"],active_effects:[{id:"minecraft:invisibility",amplifier:0,duration:-1,show_particles:0b}]}/summon bat ~-2 ~3 ~-1 {Silent:1b,NoAI:0b,PersistenceRequired:1b,Tags:["c9_fly","c9_f2"],active_effects:[{id:"minecraft:invisibility",amplifier:0,duration:-1,show_particles:0b}]}/summon bat ~1 ~2 ~-2 {Silent:1b,NoAI:0b,PersistenceRequired:1b,Tags:["c9_fly","c9_f1"],active_effects:[{id:"minecraft:invisibility",amplifier:0,duration:-1,show_particles:0b}]}/summon bat ~-1 ~4 ~2 {Silent:1b,NoAI:0b,PersistenceRequired:1b,Tags:["c9_fly","c9_f2"],active_effects:[{id:"minecraft:invisibility",amplifier:0,duration:-1,show_particles:0b}]}/scoreboard players add @e[tag=c9_center] c9_timer 1/execute as @e[tag=c9_center,scores={c9_timer=40..}] run scoreboard players set @s c9_timer 0/execute as @e[tag=c9_center] at @s run tp @s ~ ~ ~ ~4 ~/execute at @e[tag=c9_center] positioned ^ ^1 ^3.5 run particle dust_color_transition{from_color:[0.8,1.0,0.1],to_color:[1.0,0.6,0.0],scale:1.2} ~ ~ ~ 0.1 0.1 0.1 0 2 force/execute at @e[tag=c9_center] positioned ^ ^0.5 ^-3.5 run particle dust_color_transition{from_color:[0.6,1.0,0.2],to_color:[1.0,0.8,0.0],scale:1.2} ~ ~ ~ 0.1 0.1 0.1 0 2 force/execute at @e[tag=c9_center] positioned ^2.5 ^1.8 ^1 run particle dust_color_transition{from_color:[1.0,0.9,0.2],to_color:[0.4,0.9,0.1],scale:1.1} ~ ~ ~ 0.1 0.1 0.1 0 2 force/execute if entity @e[tag=c9_center,scores={c9_timer=1..25}] at @e[tag=c9_f1] run particle dust_color_transition{from_color:[0.7,1.0,0.1],to_color:[1.0,0.7,0.0],scale:1.3} ~ ~0.3 ~ 0.15 0.15 0.15 0 3 force/execute if entity @e[tag=c9_center,scores={c9_timer=15..38}] at @e[tag=c9_f2] run particle dust_color_transition{from_color:[1.0,0.9,0.1],to_color:[0.5,1.0,0.1],scale:1.3} ~ ~0.3 ~ 0.15 0.15 0.15 0 3 force/execute at @e[tag=c9_fly] run particle wax_on ~ ~0.3 ~ 0.4 0.4 0.4 0.01 1 force/execute at @e[tag=c9_center] run particle end_rod ~ ~0.5 ~ 5 2.5 5 0.005 2 force/execute at @e[tag=c9_center] run particle spore_blossom_air ~ ~2 ~ 6 3 6 0.01 4 force/execute at @e[tag=c9_center] as @e[tag=c9_fly,distance=7..] run tp @s ~ ~1.5 ~setup #7 Summons an invisible, silent bat tagged <code>c9_fly</code> and <code>c9_f1</code>. Because bats fly around erratically on their own, they make great invisible carriers for firefly particles without needing complex math.loop #1 Runs a 40-tick (2-second) cycle timer on the central marker armor stand so the fireflies can blink on and off in alternating groups instead of glowing uniformly all the time.loop #4 Projects a constant ring of fireflies orbiting 3.5 blocks out from the rotating center stand using local coordinates (<code>^ ^1 ^3.5</code>) and a <code>dust_color_transition</code> particle that shifts from lime green to warm amber.loop #7 Displays the glowing firefly body on group 1 bats (<code>c9_f1</code>) only during ticks 1 through 25 of the cycle, creating a realistic firefly blinking pattern.loop #12 Keeps the swarm contained around the lantern: if any invisible bat flies more than 7 blocks away from the center marker, it gets gently teleported back near the lantern.


Recorded on our own test server: 59 frames at about 9.7 fps. Our image check saw: A swarm of glowing yellow-green, orange, and white particles drift around a lantern at night.
Commands, video and screenshots: tested and recorded by www.9minecraft.net © 9Minecraft. Sharing a video or screenshot? Please credit www.9minecraft.net.
If you want the firefly swarm to follow you through dark caves or forests instead of staying around a lantern, skip building the lantern post and replace @e[tag=c9_center] in the loop commands with @a[ limit=1] (or a specific player name). The orbiting fireflies and wandering bats will follow you wherever you walk and tether back to you whenever you move more than 7 blocks ahead.
/kill @e[tag=c9_fly]/kill @e[tag=c9_center]/scoreboard objectives remove c9_timer/fill ~-2 ~-1 ~-2 ~2 ~2 ~2 air/fill ~-2 ~-1 ~-2 ~2 ~-1 ~2 grass_blockArmor stands only move where you teleport them, which can look robotic unless you write lots of movement commands. Bats naturally swoop, dip, and change direction on their own, giving the fireflies lifelike motion for free.
Edit the RGB numbers inside from_color and to_color in the dust_color_transition commands. Each number runs from 0.0 to 1.0 for Red, Green, and Blue—for example, [0.1,0.8,1.0] makes glowing cyan fairy lights.
▶Swirling Murmuration of Starling ParticlesTrails & PathsExpert23 cmds
▶Swarm of Glowing FirefliesTrails & PathsEasy24 cmds
▶Bioluminescent Twilight SwarmTrails & PathsEasy22 cmds
▶Dynamic Glowbug SwarmTrails & PathsEasy22 cmds
▶Unfurling Chinese Dragon Parade RibbonTrails & PathsHard21 cmds
▶Rolling Japanese Karakuri Tea AutomatonTrails & PathsExpert24 cmds