Build an automated plasma defense turret in Vanilla Minecraft using block displays that tracks and blasts hostile monsters with glowing energy bolts.
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.
/scoreboard objectives add c9_timer dummy/fill ~-2 ~-1 ~-2 ~2 ~-1 ~2 polished_blackstone_bricks/fill ~-1 ~-1 ~-1 ~1 ~-1 ~1 chiseled_polished_blackstone/setblock ~ ~ ~ lodestone/setblock ~ ~1 ~ hopper[facing=down]/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}/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}/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}/summon marker ~5 ~ ~4 {Tags:["c9_ent","c9_spawner"]}/summon marker ~-5 ~ ~4 {Tags:["c9_ent","c9_spawner"]}/scoreboard players add #tick c9_timer 1/execute if score #tick c9_timer matches 40.. run scoreboard players set #tick c9_timer 0/execute as @e[tag=c9_spawner] at @s run particle soul_fire_flame ~ ~0.5 ~ 0.3 0.5 0.3 0.02 2/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}/execute as @e[tag=c9_mob] at @s facing ~ ~ ~ run tp @s ^ ^ ^0.07 ~ ~/execute as @e[tag=c9_turret] at @s unless entity @e[tag=c9_mob,distance=..16] run tp @s ~ ~ ~ ~8 ~/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 ~ ~ ~ ~ ~/execute as @e[tag=c9_barrel] at @e[tag=c9_turret,limit=1] rotated as @e[tag=c9_turret,limit=1] run tp @s ~ ~ ~ ~ ~/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/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/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}/execute as @e[tag=c9_bullet,distance=..2.6] at @s rotated as @e[tag=c9_turret,limit=1] run tp @s ~ ~ ~ ~ ~/execute as @e[tag=c9_bullet] at @s run tp @s ^ ^ ^0.95/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/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/execute as @e[tag=c9_bullet] at @s as @e[tag=c9_mob,distance=..1.8,limit=1] run damage @s 3 minecraft:magicsetup #6 Summons an <code>item_display</code> showing a glowing cyan beacon core with <code>teleport_duration:2</code> so all head rotations interpolate smoothly.setup #7 Creates the twin turret barrels using scaled <code>block_display</code> entities offset to the left and right of the beacon center.loop #7 Uses <code>facing entity</code> targeting the nearest monster's eyes to aim the turret head directly at the closest threat within 16 blocks.loop #8 Syncs the rotation of both barrel block displays to match the main turret core every tick.loop #11 Summons short-lived <code>area_effect_cloud</code> projectiles in front of the barrels when a target is locked, which fly forward along their local Z axis (<code>^ ^ ^0.95</code>) and deal magic damage on contact.


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.
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.
/kill @e[tag=c9_ent]/scoreboard objectives remove c9_timer/fill ~-2 ~-1 ~-2 ~2 ~-1 ~2 grass_block/fill ~ ~ ~ ~ ~2 ~ airThe display entities have teleport_duration set to 2 ticks, which tells the Minecraft client to smoothly interpolate rotation changes between server ticks.
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.
▶Autonomous Lightning TurretLasers & BeamsMedium26 cmds
▶Overcharged Railgun Multi-Wall PiercerLasers & BeamsHard24 cmds
▶Automated Sentinel TurretLasers & BeamsMedium24 cmds
▶Autonomous Defense TurretLasers & BeamsMedium24 cmds
▶Barbershop Pole Helical Blood-Letting LanceLasers & BeamsHard22 cmds
▶Cyber-Grid Laser Wireframe Slicer CubeLasers & BeamsExpert24 cmds