Autonomous Sentinel Turret

Build an automated defense tower in Minecraft using command blocks that tracks wandering monsters and zaps them with vibrant cyan particle beams.

Java EditionWands, Weapons & ToolsMedium22 commandsTested on a real 26.2 & 26.3 server
A glowing beacon turret on a stone pedestal fires a cyan particle beam at an approaching husk. Download the GIF Video & GIF © www.9minecraft.net

Lasers & BeamsTechnologyMysticCyanGoldWhiteAdventure MapMini-gameMap MakingBlock displaysItem displaysSummoned mobsBlock building (fill/setblock/clone)Glowing outlinesRotation math21+ commands

The Autonomous Sentinel Turret is a self-operating defense structure built on a stone pedestal with a glowing beacon core. A floating golden crystal orbits above the base, rotating to lock onto nearby threats.

As wandering monsters approach the tower, the sentinel calculates the angle and fires a continuous cyan laser beam that zaps targets with magic particles and lightning bursts until they are defeated.

1. Setup - type these once 9 commands

  1. /scoreboard objectives add c9_timer dummy
  2. /fill ~-1 ~ ~-1 ~1 ~ ~1 polished_deepslate_slab[type=bottom]
  3. /setblock ~ ~ ~ chiseled_polished_blackstone
  4. /setblock ~ ~1 ~ polished_blackstone_wall
  5. /setblock ~ ~2 ~ beacon
  6. /summon block_display ~ ~3.3 ~ {Tags:["c9_turret"],Glowing:1b,glow_color_override:65535,block_state:{Name:"minecraft:sea_lantern"},transformation:{translation:[-0.35f,-0.35f,-0.35f],scale:[0.7f,0.7f,0.7f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
  7. /summon item_display ~ ~3.3 ~ {Tags:["c9_ring"],Glowing:1b,glow_color_override:16766720,item:{id:"minecraft:amethyst_Cluster",count:1},transformation:{translation:[0f,-0.2f,0f],scale:[1.3f,1.3f,1.3f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
  8. /summon husk ~7 ~ ~4 {Tags:["c9_mob"],Glowing:1b,CustomName:'{"text":"Intruder","color":"red"}'}
  9. /summon husk ~-6 ~ ~-5 {Tags:["c9_mob"],Glowing:1b,CustomName:'{"text":"Intruder","color":"red"}'}

2. Loop - one repeating command block each (Always Active) 13 commands

  1. /scoreboard players add #tick c9_timer 1
  2. /execute if score #tick c9_timer matches 45.. run scoreboard players set #tick c9_timer 0
  3. /execute if score #tick c9_timer matches 0 if entity @e[tag=c9_mob,limit=4] unless entity @e[tag=c9_mob,limit=5] run summon husk ~6 ~ ~-6 {Tags:["c9_mob"],Glowing:1b,CustomName:'{"text":"Intruder","color":"red"}'}
  4. /execute if score #tick c9_timer matches 22 if entity @e[tag=c9_mob,limit=4] unless entity @e[tag=c9_mob,limit=5] run summon stray ~-7 ~ ~5 {Tags:["c9_mob"],Glowing:1b,CustomName:'{"text":"Intruder","color":"red"}'}
  5. /execute as @e[tag=c9_turret] at @s facing entity @e[tag=c9_mob,sort=nearest,limit=1] feet run tp @s ~ ~ ~ ~ ~
  6. /execute as @e[tag=c9_ring] at @s run tp @s ~ ~ ~ ~10 ~
  7. /execute at @e[tag=c9_turret] run particle end_rod ~ ~ ~ 0.3 0.3 0.3 0.02 1 force
  8. /execute if score #tick c9_timer matches 1..15 at @e[tag=c9_turret] if entity @e[tag=c9_mob,distance=..16] run summon area_effect_cloud ~ ~ ~ {Tags:["c9_ray"],Duration:2}
  9. /execute as @e[tag=c9_ray] at @s facing entity @e[tag=c9_mob,sort=nearest,limit=1] eyes run tp @s ^ ^ ^0.95
  10. /execute as @e[tag=c9_ray] at @s run particle dust{color:[0.0,1.0,1.0],scale:1.3} ~ ~ ~ 0.05 0.05 0.05 0 2 force
  11. /execute as @e[tag=c9_ray] at @s run particle electric_spark ~ ~ ~ 0.1 0.1 0.1 0.05 1 force
  12. /execute if score #tick c9_timer matches 15 at @e[tag=c9_turret] as @e[tag=c9_mob,distance=..16,sort=nearest,limit=1] at @s run damage @s 6 minecraft:magic
  13. /execute if score #tick c9_timer matches 15 at @e[tag=c9_turret] as @e[tag=c9_mob,distance=..16,sort=nearest,limit=1] at @s run particle flash ~ ~1 ~ 0 0 0 0 1 force

How it works

Frames from the test run

Autonomous Sentinel Turret - frame 1Autonomous Sentinel Turret - frame 2Autonomous Sentinel Turret - frame 3

Recorded on our own test server: 59 frames at about 9.8 fps. Our image check saw: A beacon turret on a stone pedestal with a floating glowing block above it shoots a line of cyan particles at a glowing husk, damaging it.

Commands, video and screenshots: tested and recorded by www.9minecraft.net © 9Minecraft. Sharing a video or screenshot? Please credit www.9minecraft.net.

Build it in your world

  1. Choose a flat open area and stand where you want the turret base to be built.
  2. Run each command from the setup list once in chat to construct the pedestal, the floating crystal core, and the initial test monsters.
  3. Place a line of 13 repeating command blocks nearby, all set to Always Active.
  4. Paste one command from the loop list into each repeating command block.
  5. Watch the floating core lock onto nearby monsters and fire glowing cyan particle beams until they are eliminated.

Use it with real players

To make the turret defend you against all natural hostile mobs in your world instead of only tagged test mobs, replace tag=c9_mob in the loop commands with type=#minecraft:raiders or type=!player,type=!item,type=!block_display,type=!item_display,type=!area_effect_cloud,distance=..16, and skip the mob-spawning commands in setup indices 7-8 and loop indices 2-3.

Remove it again 6 commands

  1. /kill @e[tag=c9_turret]
  2. /kill @e[tag=c9_ring]
  3. /kill @e[tag=c9_ray]
  4. /kill @e[tag=c9_mob]
  5. /fill ~-1 ~ ~-1 ~1 ~3 ~1 air
  6. /scoreboard objectives remove c9_timer

FAQ

Why does the laser use area effect clouds instead of armor stands?

Area effect clouds have a built-in Duration tag so they automatically despawn after 2 ticks, creating a clean traveling beam without needing extra cleanup commands.

Can I change the range or damage of the turret?

Yes. Change distance=..16 in the loop commands to increase the detection radius, or adjust the number 6 in the /damage command to make each zap stronger.

Commands used

/damage/execute/fill/particle/scoreboard/setblock/summon/tp

Similar creations

Join 9Minecraft News & Guides