Patrolling guards project green laser cones of dust particles that clip dynamically against stone walls and flash red whenever they intersect a moving target.
Shapes & GeometryTechnologyMedievalGreenRedMini-gameAdventure MapMap MakingRiding & passengersSummoned mobsBlock building (fill/setblock/clone)Rotation math21+ commands
Two patrolling pillager guards sweep the courtyard with seven-beam green laser cones made of glowing dust particles. Whenever a beam hits one of the stone walls, it stops cleanly instead of passing through.
A glowing creeper circles the inner lane in the opposite direction. When a guard's vision cone sweeps past the walls and catches the target in the open, the intersecting beams instantly switch from green to bright red.
/scoreboard objectives add c9age dummy/scoreboard objectives add c9red dummy/scoreboard objectives add c9rot dummy/scoreboard objectives add c9off dummy/fill ~ ~ ~-1 ~ ~2 ~1 minecraft:polished_deepslate/fill ~-1 ~ ~5 ~1 ~2 ~5 minecraft:stone_bricks/summon area_effect_cloud ~-7 ~ ~ {Duration:1,WaitTime:0,Radius:0.0f,Passengers:[{id:"minecraft:pillager",Tags:["c9_guard","c9_g1"],NoAI:1b,Silent:1b,Invulnerable:1b,PersistenceRequired:1b,Rotation:[180.0f,0.0f],equipment:{mainhand:{id:"minecraft:crossbow",count:1}}},{id:"minecraft:marker",Tags:["c9_ray","c9_r1"],data:{off:-210}},{id:"minecraft:marker",Tags:["c9_ray","c9_r1"],data:{off:-140}},{id:"minecraft:marker",Tags:["c9_ray","c9_r1"],data:{off:-70}},{id:"minecraft:marker",Tags:["c9_ray","c9_r1"],data:{off:0}},{id:"minecraft:marker",Tags:["c9_ray","c9_r1"],data:{off:70}},{id:"minecraft:marker",Tags:["c9_ray","c9_r1"],data:{off:140}},{id:"minecraft:marker",Tags:["c9_ray","c9_r1"],data:{off:210}}]}/summon area_effect_cloud ~7 ~ ~ {Duration:1,WaitTime:0,Radius:0.0f,Passengers:[{id:"minecraft:pillager",Tags:["c9_guard","c9_g2"],NoAI:1b,Silent:1b,Invulnerable:1b,PersistenceRequired:1b,Rotation:[0.0f,0.0f],equipment:{mainhand:{id:"minecraft:crossbow",count:1}}},{id:"minecraft:marker",Tags:["c9_ray","c9_r2"],data:{off:-210}},{id:"minecraft:marker",Tags:["c9_ray","c9_r2"],data:{off:-140}},{id:"minecraft:marker",Tags:["c9_ray","c9_r2"],data:{off:-70}},{id:"minecraft:marker",Tags:["c9_ray","c9_r2"],data:{off:0}},{id:"minecraft:marker",Tags:["c9_ray","c9_r2"],data:{off:70}},{id:"minecraft:marker",Tags:["c9_ray","c9_r2"],data:{off:140}},{id:"minecraft:marker",Tags:["c9_ray","c9_r2"],data:{off:210}}]}/summon creeper ~-3.5 ~ ~ {Tags:["c9_target"],NoAI:1b,Silent:1b,Invulnerable:1b,PersistenceRequired:1b,Glowing:1b,Rotation:[0.0f,0.0f]}/execute as @e[tag=c9_ray] store result score @s c9off run data get entity @s data.off/execute as @e[tag=c9_guard] at @s positioned ^ ^ ^0.094 run tp @s ~ ~ ~ ~1.2 ~/execute as @e[tag=c9_target] at @s positioned ^ ^ ^0.147 run tp @s ~ ~ ~ ~-2.4 ~/scoreboard players add @e[tag=c9_ray] c9age 1/scoreboard players remove @e[tag=c9_ray,scores={c9red=1..}] c9red 1/execute as @e[tag=c9_ray,scores={c9age=10..}] run scoreboard players set @s c9age 0/execute as @e[tag=c9_r1,scores={c9age=0}] at @e[tag=c9_g1,limit=1] run tp @s ~ ~1.5 ~ ~ 0/execute as @e[tag=c9_r2,scores={c9age=0}] at @e[tag=c9_g2,limit=1] run tp @s ~ ~1.5 ~ ~ 0/execute as @e[tag=c9_ray,scores={c9age=0}] store result score @s c9rot run data get entity @s Rotation[0] 10/execute as @e[tag=c9_ray,scores={c9age=0}] run scoreboard players operation @s c9rot += @s c9off/execute as @e[tag=c9_ray,scores={c9age=0}] store result entity @s Rotation[0] float 0.1 run scoreboard players get @s c9rot/execute as @e[tag=c9_ray] at @s if block ~ ~ ~ air unless entity @e[tag=c9_target,distance=..1.2] run tp @s ^ ^ ^0.7/execute as @e[tag=c9_ray] at @s if entity @e[tag=c9_target,distance=..1.4] run scoreboard players set @s c9red 14/execute as @e[tag=c9_ray] unless score @s c9red matches 1.. at @s if block ~ ~ ~ air run particle dust{color:[0.1,1.0,0.25],scale:1.5} ~ ~ ~ 0.06 0.04 0.06 0 2 force/execute as @e[tag=c9_ray,scores={c9red=1..}] at @s if block ~ ~ ~ air run particle dust{color:[1.0,0.1,0.1],scale:1.8} ~ ~ ~ 0.08 0.05 0.08 0 3 forcesetup #7 Spawns Guard 1 together with 7 <code>marker</code> ray entities using a temporary 1-tick <code>area_effect_cloud</code>, storing each beam's angle offset in tenths of a degree inside <code>data.off</code>.loop #6 Whenever a ray finishes its 10-tick range and resets <code>c9age</code> to 0, it snaps back to Guard 1's eye height and copies the guard's current yaw.loop #9 Adds each ray marker's stored <code>c9off</code> angle (-21 to +21 degrees) onto the guard's yaw before writing it back into <code>Rotation[0]</code> to form a 7-ray fan.loop #11 Advances each ray 0.7 blocks along its local facing direction only while it stays inside <code>air</code> and has not hit <code>c9_target</code>, clipping beams at solid walls.loop #12 Sets the <code>c9red</code> timer to 14 ticks on any ray within 1.4 blocks of the target so that beam renders red from the guard to the target.loop #13 Spawns green <code>dust</code> particles at each unobstructed ray step while <code>c9red</code> is inactive, while the next command switches those particles to red when <code>c9red</code> is 1 or higher.


Recorded on our own test server: 58 frames at about 9.4 fps. Our image check saw: Two pillagers patrol around small stone walls with green particle cones emitting from them, while a glowing creeper walks in the opposite direction.
Commands, video and screenshots: tested and recorded by www.9minecraft.net © 9Minecraft. Sharing a video or screenshot? Please credit www.9minecraft.net.
To play stealth against the guards yourself, remove the demo creeper with /kill @e[tag=c9_target], delete the second loop command that moves the target, and run /tag @s add c9_target on any player who wants to be detected (or replace @e[tag=c9_target,distance=..1.2] and distance=..1.4 in loop commands 11 and 12 with @a[gamemode=survival]).
/kill @e[tag=c9_guard]/kill @e[tag=c9_target]/kill @e[tag=c9_ray]/fill ~ ~ ~-1 ~ ~2 ~1 minecraft:air/fill ~-1 ~ ~5 ~1 ~2 ~5 minecraft:air/scoreboard objectives remove c9age/scoreboard objectives remove c9red/scoreboard objectives remove c9rot/scoreboard objectives remove c9offYes. Any solid block placed in the arena will block the rays because the step and particle commands only run inside <code>air</code> blocks.
To adjust the range, change the <code>0.7</code> step distance in loop command 11 or the <code>10..</code> reset threshold in loop command 5. To widen the cone, edit the <code>off</code> values in setup commands 7 and 8 (in tenths of a degree).
▶Spinning Potter's Wheel Clay VaseShapes & GeometryHard24 cmds
▶Ferrofluid Magnetic Spike Dance SculptureShapes & GeometryHard23 cmds
▶Kinetic Raindrop Matrix Sculpture Shape-ShifterShapes & GeometryExpert24 cmds
▶Shattering Stained-Glass Rose Window MandalaShapes & GeometryHard24 cmds
▶Spinning Crookes Radiometer Light MillShapes & GeometryMedium23 cmds
▶Acoustic Chladni Plate Sand ResonanceShapes & GeometryExpert24 cmds