Build an automated predictive turret in Vanilla Minecraft that leads moving targets by calculating their trajectory ahead of time using command blocks.
Projectiles & MissilesTechnologyGreenRedCyanPvPMini-gameLearningBlock displaysArmor standsSmooth animation (interpolation)Summoned mobsBlock building (fill/setblock/clone)Rotation math21+ commands
Traditional command-block turrets aim straight at a mob's current coordinates, causing every shot to lag behind fast-moving targets. This Autonomous Predictive Sentry Turret calculates where a moving target is heading by projecting a green lead reticle ahead of its facing direction, locking the turret barrel onto the future intercept point before firing high-velocity plasma bolts.
In this self-running showcase, a central heavy sentry turret tracks two glowing Breeze targets orbiting at high speed, visually demonstrating real-time trajectory prediction, laser target leading, and direct mid-air interceptions.
/scoreboard objectives add c9_timer dummy/fill ~-2 ~-1 ~-2 ~2 ~-1 ~2 minecraft:polished_deepslate/fill ~-1 ~ ~-1 ~1 ~ ~1 minecraft:chiseled_deepslate/setblock ~ ~1 ~ minecraft:sea_lantern/summon minecraft:armor_stand ~ ~2.2 ~ {NoGravity:1b,Invisible:1b,Tags:["c9_sim","c9_turret"]}/summon minecraft:block_display ~ ~2.2 ~ {Tags:["c9_sim","c9_core"],Glowing:1b,glow_color_override:16755200,teleport_duration:1,transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[1.2f,1.2f,1.2f],translation:[-0.6f,-0.6f,-0.6f]},block_state:{Name:"minecraft:observer",Properties:{facing:"south"}}}/summon minecraft:block_display ~ ~2.2 ~ {Tags:["c9_sim","c9_barrel"],Glowing:1b,glow_color_override:65535,teleport_duration:1,transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],scale:[0.35f,0.35f,2.6f],translation:[-0.175f,-0.175f,0.1f]},block_state:{Name:"minecraft:cyan_concrete"}}/summon minecraft:armor_stand ~ ~1.6 ~ {NoGravity:1b,Invisible:1b,Tags:["c9_sim","c9_rotor"],Rotation:[0f,0f]}/summon minecraft:armor_stand ~ ~1.6 ~ {NoGravity:1b,Invisible:1b,Tags:["c9_sim","c9_lead"]}/summon minecraft:breeze ~5.5 ~1.5 ~ {NoAI:1b,NoGravity:1b,Silent:1b,Glowing:1b,Tags:["c9_sim","c9_target","c9_t1"]}/scoreboard players add #c9_tick c9_timer 1/execute as @e[tag=c9_rotor] at @s run tp @s ~ ~ ~ ~8 ~/execute at @e[tag=c9_rotor] run tp @e[tag=c9_t1,limit=1] ^ ^ ^5.5 ~90 ~/execute at @e[tag=c9_t1] run particle minecraft:trial_spawner_detection_ominous ~ ~0.2 ~ 0.15 0.15 0.15 0.01 2 force/execute at @e[tag=c9_t1] positioned ^ ^0.8 ^2.6 run tp @e[tag=c9_lead,limit=1] ~ ~ ~/execute at @e[tag=c9_lead] run particle minecraft:dust{color:[0.1,1.0,0.2],scale:2.0} ~ ~ ~ 0.12 0.12 0.12 0 5 force/execute as @e[tag=c9_turret] at @s run tp @s ~ ~ ~ facing entity @e[tag=c9_lead,limit=1] feet/execute as @e[tag=c9_barrel] at @e[tag=c9_turret,limit=1] run tp @s ~ ~ ~ ~ ~/execute as @e[tag=c9_core] at @e[tag=c9_turret,limit=1] run tp @s ~ ~ ~ ~ ~/execute at @e[tag=c9_turret] run particle minecraft:dust{color:[1.0,0.15,0.2],scale:1.2} ^ ^ ^3.2 0.05 0.05 0.05 0 2 force/execute if score #c9_tick c9_timer matches 6.. at @e[tag=c9_turret] run summon minecraft:area_effect_cloud ^ ^ ^1.8 {Duration:14,Radius:0f,Tags:["c9_sim","c9_bullet"]}/execute if score #c9_tick c9_timer matches 6.. run scoreboard players set #c9_tick c9_timer 0/execute as @e[tag=c9_bullet] at @s rotated as @e[tag=c9_turret,limit=1] run tp @s ^ ^ ^1.2 ~ ~/execute as @e[tag=c9_bullet] at @s run particle minecraft:soul_fire_flame ~ ~ ~ 0.06 0.06 0.06 0.01 5 forcesetup #6 Summons the turret's glowing head using a <code>block_display</code> entity offset by <code>[-0.6f,-0.6f,-0.6f]</code> so its center pivot stays locked directly on top of the central pedestal.loop #5 Projects the target's future position by running relative local coordinates <code>^ ^0.8 ^2.6</code> from the moving Breeze's facing direction and teleporting the <code>c9_lead</code> marker there.loop #7 Keeps the turret anchored at the center pedestal with <code>as @e[tag=c9_turret] at @s</code> while rotating it to face the predicted lead marker.loop #11 Fires a short-lived <code>area_effect_cloud</code> projectile every 6 ticks from the tip of the cyan barrel along the predicted intercept line.


Recorded on our own test server: 60 frames at about 9.9 fps. Our image check saw: A glowing observer-and-diamond-barrel turret sits on a deepslate pedestal surrounded by a green particle perimeter ring, tracking a moving target with a red targeting line and green predictive reticle while firing blue flame projectiles.
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 target real sprinting players instead of the demo Breeze, replace @e[tag=c9_t1] in loop commands 4 and 5 with @a[distance=..16,sort=nearest,limit=1], and add a damage command on bullet impact: /execute at @e[tag=c9_bullet] run damage @a[distance=..1.5,limit=1] 4 minecraft:magic.
/kill @e[tag=c9_sim]/scoreboard objectives remove c9_timer/fill ~-2 ~ ~-2 ~2 ~3 ~2 minecraft:air/fill ~-2 ~-1 ~-2 ~2 ~-1 ~2 minecraft:grass_blockStandard command turrets aim directly at an entity's current position. By the time a projectile travels there, the target has already moved forward. Using caret offsets (^ ^ ^2.6) projects an aim point ahead of the target's movement.
Adjust the Z caret value in loop command 5 (positioned ^ ^0.8 ^2.6). Increase 2.6 for faster targets or further ranges, or decrease it for slower mobs.
▶Ferris-Wheel Gondola Revolver CannonProjectiles & MissilesExpert24 cmds
▶Magnetic Rail-Track Javelin AssemblerProjectiles & MissilesExpert22 cmds
▶Pachinko-Board Trick-Shot CrossbowProjectiles & MissilesExpert24 cmds
▶Steampunk Piston-Hammer Pilebunker GauntletProjectiles & MissilesMedium24 cmds
▶16-Way Automated ArtilleryProjectiles & MissilesHard25 cmds
▶Archimedes Water-Screw Hydro-Vortex CannonProjectiles & MissilesHard24 cmds