Automated Botanical Defense

Build a self-playing garden defense in vanilla Minecraft where animated pea-turrets fire green projectiles and explosive blasts at marching zombies.

Java EditionMobs & PetsHard24 commandsTested on a real 26.2 & 26.3 server
Plant turrets behind an oak wall shoot glowing projectiles at zombies across an emerald block lawn. Download the GIF Video & GIF © www.9minecraft.net

Custom MobsNatureHorrorGreenOrangeMini-gameMap MakingParticlesBlock displaysScoreboard timersExecute chainsSummoned mobsBlock building (fill/setblock/clone)Glowing outlines21+ commands

This command creation builds an automated garden defense showcase across a five-lane emerald lawn. Five animated botanical turrets sit behind protective oak walls on the left side while waves of armored undead march across from the right.

Using block display entities and scoreboard timers, the flora automatically track incoming targets and fire glowing slime-pea projectiles. Every third volley charges up an orange explosive blast that detonates on impact, knocking back and eliminating nearby zombies.

1. Setup - type these once 9 commands

  1. /scoreboard objectives add c9_t dummy
  2. /fill ~-9 ~-1 ~-4 ~9 ~-1 ~4 emerald_block
  3. /fill ~-6 ~ ~-4 ~-6 ~ ~4 oak_wood
  4. /summon marker ~ ~ ~ {Tags:["c9_e","c9_ctrl"]}
  5. /summon block_display ~-8 ~ ~-4 {Tags:["c9_e","c9_plant"],block_state:{Name:"minecraft:melon"},Glowing:1b,glow_color_override:65280,transformation:{translation:[-0.35f,0.1f,-0.35f],scale:[0.7f,0.7f,0.7f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
  6. /summon block_display ~-8 ~ ~-2 {Tags:["c9_e","c9_plant"],block_state:{Name:"minecraft:melon"},Glowing:1b,glow_color_override:65280,transformation:{translation:[-0.35f,0.1f,-0.35f],scale:[0.7f,0.7f,0.7f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
  7. /summon block_display ~-8 ~ ~ {Tags:["c9_e","c9_plant"],block_state:{Name:"minecraft:melon"},Glowing:1b,glow_color_override:65280,transformation:{translation:[-0.35f,0.1f,-0.35f],scale:[0.7f,0.7f,0.7f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
  8. /summon block_display ~-8 ~ ~2 {Tags:["c9_e","c9_plant"],block_state:{Name:"minecraft:melon"},Glowing:1b,glow_color_override:65280,transformation:{translation:[-0.35f,0.1f,-0.35f],scale:[0.7f,0.7f,0.7f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
  9. /summon block_display ~-8 ~ ~4 {Tags:["c9_e","c9_plant"],block_state:{Name:"minecraft:melon"},Glowing:1b,glow_color_override:65280,transformation:{translation:[-0.35f,0.1f,-0.35f],scale:[0.7f,0.7f,0.7f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}

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

  1. /scoreboard players add @e[tag=c9_ctrl] c9_t 1
  2. /execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 1..60 as @e[tag=c9_plant] at @s run particle happy_villager ~ ~0.4 ~ 0.2 0.2 0.2 0 1
  3. /execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 15 run summon zombie ~8 ~ ~-4 {Tags:["c9_e","c9_z"],NoAI:1b,Silent:1b,Rotation:[90f,0f],armor_items:[{},{},{},{id:"minecraft:leather_helmet",count:1}]}
  4. /execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 30 run summon husk ~8 ~ ~ {Tags:["c9_e","c9_z"],NoAI:1b,Silent:1b,Rotation:[90f,0f],armor_items:[{},{},{},{id:"minecraft:golden_helmet",count:1}]}
  5. /execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 45 run summon zombie ~8 ~ ~4 {Tags:["c9_e","c9_z"],NoAI:1b,Silent:1b,Rotation:[90f,0f],armor_items:[{},{},{},{id:"minecraft:iron_helmet",count:1}]}
  6. /execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 60 run summon zombie ~8 ~ ~-2 {Tags:["c9_e","c9_z"],NoAI:1b,Silent:1b,Rotation:[90f,0f],armor_items:[{},{},{},{id:"minecraft:copper_helmet",count:1}]}
  7. /execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 25 as @e[tag=c9_plant] at @s run summon block_display ~0.6 ~0.4 ~ {Tags:["c9_e","c9_pea"],block_state:{Name:"minecraft:slime_block"},Glowing:1b,glow_color_override:65280,transformation:{translation:[-0.15f,-0.15f,-0.15f],scale:[0.3f,0.3f,0.3f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
  8. /execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 50 as @e[tag=c9_plant] at @s run summon block_display ~0.6 ~0.4 ~ {Tags:["c9_e","c9_pea","c9_bomb"],block_state:{Name:"minecraft:magma_block"},Glowing:1b,glow_color_override:16744448,transformation:{translation:[-0.2f,-0.2f,-0.2f],scale:[0.4f,0.4f,0.4f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
  9. /execute as @e[tag=c9_pea] at @s run tp @s ~0.45 ~ ~
  10. /execute as @e[tag=c9_pea] at @s run particle dust{color:[0.2,1.0,0.2],scale:1.0} ~ ~ ~ 0.05 0.05 0.05 0 2
  11. /execute as @e[tag=c9_z] at @s run tp @s ~-0.07 ~ ~
  12. /execute as @e[tag=c9_pea] at @s if entity @e[tag=c9_z,distance=..1.1] run particle explosion ~ ~0.5 ~ 0.1 0.1 0.1 0 1 force
  13. /execute as @e[tag=c9_pea] at @s if entity @e[tag=c9_z,distance=..1.1] run damage @e[tag=c9_z,distance=..1.4,limit=1] 7 generic
  14. /execute if score @e[tag=c9_ctrl,limit=1] c9_t matches 60.. run scoreboard players set @e[tag=c9_ctrl] c9_t 0
  15. /kill @e[tag=c9_pea,x=10,dx=20]

How it works

Frames from the test run

Automated Botanical Defense - frame 1Automated Botanical Defense - frame 2Automated Botanical Defense - frame 3

Recorded on our own test server: 51 frames at about 8.4 fps. Our image check saw: Five botanical turrets behind an oak log barrier on a five-lane emerald block lawn shoot glowing green and orange projectiles at advancing 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. Stand in the center of a flat open area with at least 20 blocks of clearance in every direction.
  2. Run each command in the Setup list one by one in chat to build the emerald lawn, oak barricade, controller marker, and five melon turrets.
  3. Place 15 Command Blocks in a chain or line nearby and set all of them to Repeat, Unconditional, and Always Active.
  4. Paste one command from the Loop list into each repeating command block.
  5. Watch the turrets automatically fire slime peas and explosive magma blasts at incoming waves of zombies.

Use it with real players

To let players plant their own turrets anywhere in a survival world, summon the c9_plant block display at the location of a dropped melon seed item: /execute at @e[type=item,nbt={Item:{id:"minecraft:melon_seeds"}}] run summon block_display ~ ~ ~ {Tags:["c9_e","c9_plant"],block_state:{Name:"minecraft:melon"},transformation:{translation:[-0.35f,0.1f,-0.35f],scale:[0.7f,0.7f,0.7f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}, then kill the seed item right after.

Remove it again 4 commands

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

FAQ

Why do the zombies wear helmets during the day?

The helmets prevent the zombies from burning in sunlight so only the botanical turrets damage them.

How can I make the turrets shoot faster?

Lower the tick reset threshold in the second-to-last loop command from 60 to 40 and adjust the projectile spawn ticks accordingly.

Commands used

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

Similar creations

Join 9Minecraft News & Guides