Build a rotating mechanical laser turret in vanilla Minecraft that automatically tracks nearby monsters and blasts them with glowing plasma beams.
Lasers & BeamsTechnologyFireCyanOrangeWhitePvPAdventure MapDecorationBlock displaysSmooth animation (interpolation)Summoned mobsBlock building (fill/setblock/clone)SoundsGlowing outlinesRotation math21+ commands
This command creation builds a custom mechanical turret out of block display entities at the center of your base. It swivels smoothly on its pedestal, automatically locking onto the nearest wandering monster and firing high-speed cyan plasma beams that zap targets with fiery impacts.
Everything runs purely on vanilla display entities and scoreboards. In this self-running demo, armored husks spawn around the perimeter and try to approach the turret, only to get tracked and taken down by the automated defense system.
/scoreboard objectives add c9_timer dummy/fill ~-1 ~-1 ~-1 ~1 ~-1 ~1 polished_deepslate/setblock ~ ~ ~ chiseled_polished_blackstone/setblock ~ ~1 ~ lodestone/summon block_display ~ ~1.8 ~ {tags:["c9_turret","c9_part"],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]},block_state:{Name:"minecraft:iron_block"},teleport_duration:2}/summon block_display ~ ~1.8 ~ {tags:["c9_part"],transformation:{translation:[-0.15f,-0.1f,0.1f],scale:[0.3f,0.3f,1.2f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]},block_state:{Name:"minecraft:polished_deepslate"},teleport_duration:2}/summon block_display ~ ~1.8 ~ {tags:["c9_part"],transformation:{translation:[-0.2f,-0.15f,1.1f],scale:[0.4f,0.4f,0.3f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]},block_state:{Name:"minecraft:sea_lantern"},teleport_duration:2}/summon block_display ~ ~1.8 ~ {tags:["c9_part"],transformation:{translation:[-0.1f,0.2f,-0.2f],scale:[0.2f,0.3f,0.6f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]},block_state:{Name:"minecraft:redstone_block"},teleport_duration:2}/summon husk ~7 ~ ~7 {Tags:["c9_mob"],CustomName:'{"text":"Target","color":"red"}',Glowing:1b,ArmorItems:[{},{},{},{id:"minecraft:iron_helmet",count:1}]}/summon husk ~-7 ~ ~6 {Tags:["c9_mob"],CustomName:'{"text":"Target","color":"red"}',Glowing:1b,ArmorItems:[{},{},{},{id:"minecraft:iron_helmet",count:1}]}/scoreboard players add #tick c9_timer 1/scoreboard players add #spawn c9_timer 1/execute if score #tick c9_timer matches 20.. run scoreboard players set #tick c9_timer 0/execute if score #spawn c9_timer matches 45.. run scoreboard players set #spawn c9_timer 0/execute if score #spawn c9_timer matches 1 unless entity @e[tag=c9_mob,limit=5] run summon husk ~8 ~ ~-6 {Tags:["c9_mob"],CustomName:'{"text":"Target","color":"red"}',Glowing:1b,ArmorItems:[{},{},{},{id:"minecraft:iron_helmet",count:1}]}/execute if score #spawn c9_timer matches 23 unless entity @e[tag=c9_mob,limit=5] run summon husk ~-8 ~ ~-5 {Tags:["c9_mob"],CustomName:'{"text":"Target","color":"red"}',Glowing:1b,ArmorItems:[{},{},{},{id:"minecraft:iron_helmet",count:1}]}/execute as @e[tag=c9_turret] at @s if entity @e[tag=c9_mob,distance=..18] facing entity @e[tag=c9_mob,distance=..18,sort=nearest,limit=1] feet run tp @s ~ ~ ~ ~ ~/execute as @e[tag=c9_turret] at @s unless entity @e[tag=c9_mob,distance=..18] run tp @s ~ ~ ~ ~4 ~/execute at @e[tag=c9_turret] as @e[tag=c9_part,tag=!c9_turret] run tp @s ~ ~ ~ ~ ~/execute at @e[tag=c9_turret] run particle electric_spark ^ ^ ^1.3 0.1 0.1 0.1 0.02 1 force/execute if score #tick c9_timer matches 1 at @e[tag=c9_turret] if entity @e[tag=c9_mob,distance=..18] run summon area_effect_cloud ^ ^ ^1.3 {Tags:["c9_beam"],Duration:16,Radius:0f}/execute if score #tick c9_timer matches 1 at @e[tag=c9_turret] if entity @e[tag=c9_mob,distance=..18] run playsound block.beacon.deactivate master @a ~ ~ ~ 1 2/execute as @e[tag=c9_beam] at @s facing entity @e[tag=c9_mob,distance=..20,sort=nearest,limit=1] eyes run tp @s ^ ^ ^0.9/execute at @e[tag=c9_beam] run particle dust{color:[0.0,1.0,1.0],scale:1.5} ~ ~ ~ 0.05 0.05 0.05 0 4 forcesetup #5 Summons the main turret head using a <code>block_display</code> entity with an off-center translation so it rotates cleanly around its center pivot point. The <code>teleport_duration:2</code> tag makes its rotation smooth.loop #7 Finds the nearest monster tagged <code>c9_mob</code> within 18 blocks and rotates the main turret head to face it.loop #9 Syncs the barrel, glowing muzzle, and redstone sight display entities to match the rotation of the main turret head.loop #11 Once every second (20 ticks), if a target is in range, summons a short-lived invisible cloud at the tip of the barrel to act as the laser projectile.loop #13 Moves the laser projectile forward 0.9 blocks every tick while steering toward the nearest target's eyes, creating a fast homing plasma bolt.


Recorded on our own test server: 60 frames at about 9.8 fps. Our image check saw: A custom block display turret swivels on a pedestal at night, tracking a glowing armored husk in the bottom-left and firing a cyan plasma beam that hits the ground with fire.
Commands, video and screenshots: tested and recorded by www.9minecraft.net © 9Minecraft. Sharing a video or screenshot? Please credit www.9minecraft.net.
To make the turret defend you against all natural survival monsters instead of just the demo husks, replace tag=c9_mob in the loop commands with type=#minecraft:raiders or type=zombie, and remove the four husk spawning commands. Add a repeating command block running /execute at @e[tag=c9_beam] run damage @e[type=!player,type=!block_display,type=!area_effect_cloud,distance=..1.5,limit=1] 8 magic so the beam damages any hostile mob it touches.
/kill @e[tag=c9_part]/kill @e[tag=c9_beam]/kill @e[tag=c9_mob]/scoreboard objectives remove c9_timer/fill ~-1 ~-1 ~-1 ~1 ~-1 ~1 grass_block/fill ~ ~ ~ ~ ~1 ~ airThe block display entities use the teleport_duration NBT tag set to 2 ticks, which tells Minecraft to smoothly interpolate their rotation between every command tick.
Yes. Change distance=..18 in the loop commands to a larger number like distance=..30, and increase the Duration tag on the area_effect_cloud projectile so the beam can travel further before disappearing.
/execute/fill/particle/playsound/scoreboard/setblock/summon/tp
▶Orbital Death LaserLasers & BeamsMedium22 cmds
▶Orbital Starter-Base ObliteratorLasers & BeamsMedium21 cmds
▶Tactical Terrain VaporizerLasers & BeamsMedium24 cmds
▶Autonomous Laser Sentry TurretLasers & BeamsMedium24 cmds
▶Orbital Peddler ObliteratorLasers & BeamsMedium24 cmds
▶Automated Defense TurretsLasers & BeamsMedium26 cmds