Directional Wall Defense Matrix

Build an automated Minecraft perimeter wall with three sensor turrets that detect incoming desert husks and fire flaming arrows and explosive fireballs.

Java EditionWands, Weapons & ToolsMedium24 commandsTested on a real 26.2 & 26.3 server
A fortified wall shoots a red laser beam at glowing husks in a sandstone courtyard. Download the GIF Video & GIF © www.9minecraft.net

TrapsTechnologyFireRedCyanOrangeAdventure MapMap MakingPvPArmor standsSummoned mobsBlock building (fill/setblock/clone)21+ commands

The Directional Wall Defense Matrix sets up a fortified blackstone and lodestone wall equipped with three independent sensor nodes. In standby mode, each turret pulses with cyan scanning particles while monitoring a dedicated forward lane across the sandstone courtyard.

As soon as glowing siege husks enter a turret's detection zone, the node locks on with a bright red laser beam and unleashes alternating volleys of flaming arrows and explosive fireballs down the lane.

1. Setup - type these once 10 commands

  1. /scoreboard objectives add c9_timer dummy
  2. /scoreboard players set #tick c9_timer 0
  3. /fill ~-8 ~-1 ~-10 ~8 ~-1 ~10 cut_sandstone
  4. /fill ~-8 ~ ~-7 ~8 ~3 ~-7 chiseled_polished_blackstone
  5. /fill ~-7 ~1 ~-7 ~7 ~2 ~-7 iron_bars
  6. /fill ~-6 ~1 ~-7 ~-4 ~2 ~-7 lodestone
  7. /fill ~-1 ~1 ~-7 ~1 ~2 ~-7 lodestone
  8. /fill ~4 ~1 ~-7 ~6 ~2 ~-7 lodestone
  9. /summon armor_stand ~-5 ~1.5 ~-6 {Tags:["c9_node"],Invisible:1b,NoGravity:1b,Marker:1b,equipment:{head:{id:"minecraft:redstone_block",count:1}}}
  10. /summon armor_stand ~ ~1.5 ~-6 {Tags:["c9_node","c9_mid"],Invisible:1b,NoGravity:1b,Marker:1b,equipment:{head:{id:"minecraft:redstone_block",count:1}}}

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

  1. /execute unless entity @e[tag=c9_right] run summon armor_stand ~5 ~1.5 ~-6 {Tags:["c9_node","c9_right"],Invisible:1b,NoGravity:1b,Marker:1b,equipment:{head:{id:"minecraft:redstone_block",count:1}}}
  2. /scoreboard players add #tick c9_timer 1
  3. /execute if score #tick c9_timer matches 80.. run scoreboard players set #tick c9_timer 0
  4. /execute at @e[tag=c9_node] run particle dust{color:[0.0,0.85,1.0],scale:1.4} ~ ~0.4 ~ 0.35 0.35 0.15 0 3 force
  5. /execute at @e[tag=c9_node] positioned ~-2 ~-2 ~ if entity @e[type=husk,tag=c9_mob,dx=4,dy=4,dz=18] run particle dust{color:[1.0,0.05,0.05],scale:2.0} ~2 ~2.4 ~4 0.15 0.15 3.5 0 25 force
  6. /execute if score #tick c9_timer matches 2 unless entity @e[tag=c9_mob] run summon husk ~-5 ~ ~7 {Tags:["c9_mob"],CustomName:{"text":"Siege Husk","color":"gold"},Glowing:1b}
  7. /execute if score #tick c9_timer matches 5 if entity @e[tag=c9_mid] run summon husk ~ ~ ~8 {Tags:["c9_mob"],CustomName:{"text":"Siege Husk","color":"gold"},Glowing:1b}
  8. /execute if score #tick c9_timer matches 10 if entity @e[tag=c9_right] run summon husk ~5 ~ ~7 {Tags:["c9_mob"],CustomName:{"text":"Siege Husk","color":"gold"},Glowing:1b}
  9. /execute as @e[type=husk,tag=c9_mob] at @s if block ~ ~ ~-1 air run tp @s ~ ~ ~-0.07 facing ~ ~ ~-10
  10. /execute if score #tick c9_timer matches 10 at @e[tag=c9_node] positioned ~-2 ~-2 ~ if entity @e[type=husk,tag=c9_mob,dx=4,dy=4,dz=18] run summon arrow ~2 ~2.3 ~0.6 {Tags:["c9_proj"],Motion:[0.0,0.14,1.7],damage:5.0d,Fire:200s,pickup:0b}
  11. /execute if score #tick c9_timer matches 35 at @e[tag=c9_node] positioned ~-2 ~-2 ~ if entity @e[type=husk,tag=c9_mob,dx=4,dy=4,dz=18] run summon arrow ~2 ~2.3 ~0.6 {Tags:["c9_proj"],Motion:[0.0,0.14,1.7],damage:5.0d,Fire:200s,pickup:0b}
  12. /execute if score #tick c9_timer matches 60 at @e[tag=c9_node] positioned ~-2 ~-2 ~ if entity @e[type=husk,tag=c9_mob,dx=4,dy=4,dz=18] run summon fireball ~2 ~2.3 ~0.8 {Tags:["c9_proj"],acceleration_power:0.12,Motion:[0.0,-0.02,0.9],ExplosionPower:0b}
  13. /execute at @e[tag=c9_proj] run particle flame ~ ~ ~ 0.1 0.1 0.1 0.02 4 force
  14. /kill @e[tag=c9_mob,distance=20..]

How it works

Frames from the test run

Directional Wall Defense Matrix - frame 1Directional Wall Defense Matrix - frame 2Directional Wall Defense Matrix - frame 3

Recorded on our own test server: 60 frames at about 9.9 fps. Our image check saw: A fortified blackstone and lodestone wall with three nodes faces a sandstone courtyard where the middle turret fires a red particle beam and fireballs at glowing husks while the left turret pulses with cyan particles.

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 at the center of an open flat area and run the 10 setup commands in chat to build the sandstone courtyard, defense wall, and turret nodes.
  2. Place a column or row of 14 Repeating Command Blocks set to Always Active near the build.
  3. Paste one loop command into each repeating command block in the exact order listed.
  4. Watch the three redstone turret nodes scan their lanes with cyan particles and automatically lock onto the advancing husks with red laser beams.
  5. Observe the alternating volleys of flaming arrows and fireballs defending each lane independently.

Use it with real players

To make this wall defend against real players or natural survival mobs instead of demo husks, replace type=husk,tag=c9_mob in loop commands 5, 10, 11, and 12 with type=#minecraft:raiders or type=player,distance=..18, and remove loop commands 6 through 9.

Remove it again 6 commands

  1. /kill @e[tag=c9_node]
  2. /kill @e[tag=c9_mob]
  3. /kill @e[tag=c9_proj]
  4. /scoreboard objectives remove c9_timer
  5. /fill ~-8 ~ ~-10 ~8 ~4 ~10 air
  6. /fill ~-8 ~-1 ~-10 ~8 ~-1 ~10 grass_block

FAQ

Why did the turrets not fire when the nodes were higher than the mobs?

In Minecraft, box selectors like dx, dy, and dz only expand in positive directions by default. Offsetting the check with positioned ~-2 ~-2 ~ lets the elevated turret detect mobs walking on the ground below its height level.

Will the fireballs destroy the wall or floor?

No, the fireballs are summoned with ExplosionPower:0b, which creates the explosion sound, knockback, and impact damage without breaking any blocks.

Commands used

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

Similar creations

Join 9Minecraft News & Guides