Automated Defense Turrets

Build an automated plasma defense turret in Vanilla Minecraft using block displays that tracks and blasts hostile monsters with glowing energy bolts.

Java EditionWands, Weapons & ToolsMedium26 commandsTested on a real 26.2 & 26.3 server
An automated beacon turret fires blue particle beams at glowing zombies in the dark. Download the GIF Video & GIF © www.9minecraft.net

Lasers & BeamsTechnologyLightningCyanBlueBlackPvPAdventure MapDecorationParticlesBlock displaysItem displaysSmooth animation (interpolation)Scoreboard timersExecute chainsSummoned mobsBlock building (fill/setblock/clone)Glowing outlinesRotation math21+ commands

This command creation constructs an automated sentry turret at the center of your base using 3D display entities for a glowing beacon core and dual lightning rod barrels. When no threats are nearby, the turret smoothly rotates to scan the perimeter, surrounded by a pulsing laser perimeter ring.

As soon as a hostile monster steps within range, the turret immediately locks onto the target and fires rapid bursts of glowing cyan plasma bolts. Each bolt leaves a bright particle trail and detonates on impact with soul fire flames, sonic blasts, and direct magic damage.

1. Setup - type these once 10 commands

  1. /scoreboard objectives add c9_timer dummy
  2. /fill ~-2 ~-1 ~-2 ~2 ~-1 ~2 polished_blackstone_bricks
  3. /fill ~-1 ~-1 ~-1 ~1 ~-1 ~1 chiseled_polished_blackstone
  4. /setblock ~ ~ ~ lodestone
  5. /setblock ~ ~1 ~ hopper[facing=down]
  6. /summon item_display ~ ~1.8 ~ {Tags:["c9_ent","c9_turret"],item:{id:"minecraft:beacon",count:1},transformation:{translation:[0.0f,0.0f,0.0f],left_rotation:[0.0f,0.0f,0.0f,1.0f],scale:[0.85f,0.85f,0.85f],right_rotation:[0.0f,0.0f,0.0f,1.0f]},teleport_duration:2,Glowing:1b,glow_color_override:65535}
  7. /summon block_display ~ ~1.8 ~ {Tags:["c9_ent","c9_barrel"],block_state:{Name:"minecraft:End_rod",Properties:{facing:"south"}},transformation:{translation:[-0.45f,-0.25f,0.1f],left_rotation:[0.0f,0.0f,0.0f,1.0f],scale:[0.5f,0.5f,1.4f],right_rotation:[0.0f,0.0f,0.0f,1.0f]},teleport_duration:2,Glowing:1b,glow_color_override:16755200}
  8. /summon block_display ~ ~1.8 ~ {Tags:["c9_ent","c9_barrel"],block_state:{Name:"minecraft:End_rod",Properties:{facing:"south"}},transformation:{translation:[0.05f,-0.25f,0.1f],left_rotation:[0.0f,0.0f,0.0f,1.0f],scale:[0.5f,0.5f,1.4f],right_rotation:[0.0f,0.0f,0.0f,1.0f]},teleport_duration:2,Glowing:1b,glow_color_override:16755200}
  9. /summon marker ~5 ~ ~4 {Tags:["c9_ent","c9_spawner"]}
  10. /summon marker ~-5 ~ ~4 {Tags:["c9_ent","c9_spawner"]}

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

  1. /scoreboard players add #tick c9_timer 1
  2. /execute if score #tick c9_timer matches 40.. run scoreboard players set #tick c9_timer 0
  3. /execute as @e[tag=c9_spawner] at @s run particle soul_fire_flame ~ ~0.5 ~ 0.3 0.5 0.3 0.02 2
  4. /execute if score #tick c9_timer matches 1 unless entity @e[tag=c9_mob,distance=..18] as @e[tag=c9_spawner] at @s run summon husk ~ ~ ~ {Tags:["c9_ent","c9_mob"],Health:16f,Glowing:1b}
  5. /execute as @e[tag=c9_mob] at @s facing ~ ~ ~ run tp @s ^ ^ ^0.07 ~ ~
  6. /execute as @e[tag=c9_turret] at @s unless entity @e[tag=c9_mob,distance=..16] run tp @s ~ ~ ~ ~8 ~
  7. /execute as @e[tag=c9_turret] at @s if entity @e[tag=c9_mob,distance=..16] facing entity @e[tag=c9_mob,distance=..16,sort=nearest,limit=1] eyes run tp @s ~ ~ ~ ~ ~
  8. /execute as @e[tag=c9_barrel] at @e[tag=c9_turret,limit=1] rotated as @e[tag=c9_turret,limit=1] run tp @s ~ ~ ~ ~ ~
  9. /execute as @e[tag=c9_turret] at @s run particle dust{color:[0.0,1.0,1.0],scale:1.5} ^ ^ ^1.1 0.1 0.1 0.1 0 3
  10. /execute if score #tick c9_timer matches 5..35 as @e[tag=c9_turret] at @s if entity @e[tag=c9_mob,distance=..16] run particle sonic_boom ^ ^ ^2.2 0 0 0 0 1
  11. /execute if score #tick c9_timer matches 5..35 as @e[tag=c9_turret] at @s if entity @e[tag=c9_mob,distance=..16] run summon area_effect_cloud ^ ^ ^0.8 {Tags:["c9_ent","c9_bullet"],Duration:16,Radius:0f}
  12. /execute as @e[tag=c9_bullet,distance=..2.6] at @s rotated as @e[tag=c9_turret,limit=1] run tp @s ~ ~ ~ ~ ~
  13. /execute as @e[tag=c9_bullet] at @s run tp @s ^ ^ ^0.95
  14. /execute as @e[tag=c9_bullet] at @s run particle dust{color:[0.0,1.0,1.0],scale:2.0} ~ ~ ~ 0.08 0.08 0.08 0 5
  15. /execute as @e[tag=c9_bullet] at @s if entity @e[tag=c9_mob,distance=..1.8] run particle flame ~ ~ ~ 0.3 0.3 0.3 0.1 12
  16. /execute as @e[tag=c9_bullet] at @s as @e[tag=c9_mob,distance=..1.8,limit=1] run damage @s 3 minecraft:magic

How it works

Frames from the test run

Automated Defense Turrets - frame 1Automated Defense Turrets - frame 2Automated Defense Turrets - frame 3

Recorded on our own test server: 60 frames at about 9.8 fps. Our image check saw: A glowing beacon-core turret on a dark stone base rotates to fire blue particle beams and sonic boom rings at approaching zombies.

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. Create a flat area in your world and stand where you want the turret base to be built.
  2. Run each command from the Setup list once in chat (or place them in impulse command blocks) to build the blackstone pedestal, display entities, and test spawners.
  3. Place a line of 14 Repeating Command Blocks set to Always Active near your build.
  4. Paste one command from the Loop list into each repeating command block.
  5. Watch the turret automatically lock onto the spawned husks and eliminate them with cyan energy bolts.
  6. When finished, run the Remove commands to clear the display entities, scoreboard, and blocks.

Use it with real players

To use this turret for real base defense against naturally spawning monsters instead of demo husks, remove the two c9_spawner setup commands and the husk spawning loop command, then replace every instance of tag=c9_mob in the loop commands with type=#minecraft:raiders or specific hostile mobs like type=zombie.

Remove it again 4 commands

  1. /kill @e[tag=c9_ent]
  2. /scoreboard objectives remove c9_timer
  3. /fill ~-2 ~-1 ~-2 ~2 ~-1 ~2 grass_block
  4. /fill ~ ~ ~ ~ ~2 ~ air

FAQ

Why does the turret rotate smoothly instead of snapping each tick?

The display entities have teleport_duration set to 2 ticks, which tells the Minecraft client to smoothly interpolate rotation changes between server ticks.

Can I increase the firing range of the turret?

Yes! Change distance=..16 in the targeting and firing loop commands to a larger radius like distance=..24, and increase the Duration tag on the c9_bullet cloud so projectiles travel farther before expiring.

Commands used

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

Similar creations

Join 9Minecraft News & Guides