Botanical Undead Defense

Build an automated Plants vs. Zombies lawn defense in vanilla Minecraft with Peashooter turrets, Wall-nut barriers, and waves of marching zombies.

Java EditionMobs & PetsHard26 commandsTested on a real 26.2 & 26.3 server
Green peashooters fire glowing slimeballs across a five-lane Minecraft lawn defended by oversized potato wall-nuts. Download the GIF Video & GIF © www.9minecraft.net

Custom MobsNatureHorrorGreenGoldMini-gameMap MakingAdventure MapBlock displaysItem displaysArmor standsSummoned mobsBlock building (fill/setblock/clone)Glowing outlines21+ commands

Botanical Undead Defense turns a Minecraft lawn into a five-lane tower defense arena inspired by Plants vs. Zombies. Custom Peashooters built from block displays and armor stands automatically fire glowing green slime peas down their lanes, while oversized potato Wall-nuts hold the line.

Waves of helmet-wearing zombies shamble in from the dirt road on the right, getting knocked back and splattered by bursts of lime particles whenever a pea hits its mark.

1. Setup - type these once 10 commands

  1. /scoreboard objectives add c9_timer dummy
  2. /fill ~-12 ~-1 ~-7 ~12 ~-1 ~7 moss_block
  3. /fill ~-12 ~-1 ~-4 ~12 ~-1 ~-2 grass_block
  4. /fill ~-12 ~-1 ~2 ~12 ~-1 ~4 grass_block
  5. /fill ~-13 ~-1 ~-7 ~-12 ~-1 ~7 oak_planks
  6. /fill ~11 ~-1 ~-7 ~12 ~-1 ~7 rooted_dirt
  7. /summon marker ~-10 ~ ~-6 {Tags:["c9_plant_spot"]}
  8. /summon marker ~-10 ~ ~-3 {Tags:["c9_plant_spot"]}
  9. /summon marker ~-10 ~ ~ {Tags:["c9_plant_spot"]}
  10. /summon marker ~-10 ~ ~3 {Tags:["c9_plant_spot"]}

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 1 run summon marker ~-10 ~ ~6 {Tags:["c9_plant_spot"]}
  3. /execute if score #tick c9_timer matches 2 at @e[tag=c9_plant_spot] run summon armor_stand ~ ~ ~ {Tags:["c9_plant","c9_shooter"],Invisible:1b,NoGravity:1b,Marker:1b,Small:1b,equipment:{head:{id:"minecraft:lime_concrete",count:1}}}
  4. /execute if score #tick c9_timer matches 2 at @e[tag=c9_plant_spot] run summon block_display ~-0.25 ~ ~-0.25 {Tags:["c9_plant","c9_deco"],block_state:{Name:"minecraft:lime_concrete"},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0.3f,0f],scale:[0.5f,0.6f,0.5f]}}
  5. /execute if score #tick c9_timer matches 2 at @e[tag=c9_plant_spot] run summon item_display ~3 ~0.6 ~ {Tags:["c9_plant","c9_wall"],item:{id:"minecraft:potato",count:1},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0f,0f],scale:[1.6f,1.8f,1.6f]}}
  6. /execute if score #tick c9_timer matches 25 at @e[tag=c9_shooter] run summon item_display ~0.5 ~0.8 ~ {Tags:["c9_pea"],Glowing:1b,glow_color_override:65280,item:{id:"minecraft:slime_ball",count:1},transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0f,0f],scale:[0.8f,0.8f,0.8f]}}
  7. /execute if score #tick c9_timer matches 25 at @e[tag=c9_shooter] run particle happy_villager ~0.5 ~0.8 ~ 0.15 0.15 0.15 0.05 4
  8. /execute as @e[tag=c9_pea] at @s run tp @s ~0.5 ~ ~
  9. /execute at @e[tag=c9_pea] run particle item{item:{id:"minecraft:lime_dye"}} ~ ~ ~ 0.05 0.05 0.05 0.02 2
  10. /execute as @e[tag=c9_pea] at @s if entity @e[tag=c9_zom,distance=..1.5] run particle explosion ~ ~0.5 ~ 0.1 0.1 0.1 0.05 1
  11. /execute at @e[tag=c9_pea] as @e[tag=c9_zom,distance=..1.5,limit=1] at @s run damage @s 7 minecraft:magic
  12. /execute as @e[tag=c9_pea] at @s if entity @e[tag=c9_zom,distance=..1.5] run kill @s
  13. /execute if score #tick c9_timer matches 28 at @r[tag=c9_plant_spot] run summon zombie ~21 ~ ~ {Tags:["c9_zom"],Rotation:[90f,0f],Health:18f,attributes:[{id:"minecraft:movement_speed",base:0.0f}],equipment:{head:{id:"minecraft:leather_helmet",count:1}}}
  14. /execute as @e[tag=c9_zom] at @s unless entity @e[tag=c9_wall,distance=..1.3] run tp @s ~-0.08 ~ ~ 90 0
  15. /execute if score #tick c9_timer matches 30.. run scoreboard players set #tick c9_timer 10
  16. /kill @e[tag=c9_pea,distance=24..]

How it works

Frames from the test run

Botanical Undead Defense - frame 1Botanical Undead Defense - frame 2Botanical Undead Defense - frame 3

Recorded on our own test server: 59 frames at about 9.8 fps. Our image check saw: A five-lane grassy lawn in Minecraft has green peashooter blocks and potato items on the left shooting green slime projectiles to the right, though no zombies are currently visible in these frames.

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. Clear a flat 30x20 area and stand right at the center of your lawn.
  2. Run each of the 10 setup commands in chat to paint the five grass lanes and place the lane markers.
  3. Place a column or chain of 16 Command Blocks beneath the center of the stage.
  4. Set all 16 Command Blocks to Repeat, Unconditional, and Always Active (or 1 Repeating block leading into 15 Chain blocks).
  5. Paste the loop commands in order into the command blocks to spawn the plants and start the zombie waves.
  6. Watch the Peashooters automatically defend the porch as zombies march down the lanes.

Use it with real players

To let players plant towers manually instead of spawning all five lanes at once, skip the marker summon commands in setup and give players spawn eggs named Peashooter or Wall-nut. Use an execute at @e[type=endermite,name="Peashooter"] command to summon the c9_plant_spot marker where the player places the egg, then teleport the endermite into the void.

Remove it again 6 commands

  1. /kill @e[tag=c9_plant_spot]
  2. /kill @e[tag=c9_plant]
  3. /kill @e[tag=c9_pea]
  4. /kill @e[tag=c9_zom]
  5. /scoreboard objectives remove c9_timer
  6. /fill ~-13 ~-1 ~-7 ~12 ~-1 ~7 grass_block

FAQ

Why do the zombies wear leather helmets?

Since the defense game takes place during the day, the leather helmets stop the zombies from burning in the sunlight while also acting like the cone-head zombies from the original game.

How do the zombies stay inside their lanes without wandering off?

Their <code>minecraft:movement_speed</code> attribute is set to <code>0.0f</code> when summoned, and a repeating teleport command moves them straight down the X-axis until they bump into a Wall-nut.

Commands used

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

Similar creations

Join 9Minecraft News & Guides