Build a High-Voltage Perimeter in Minecraft with glowing blue plasma arcs between iron pillars that shock and knock back incoming zombies.
Shapes & GeometryLightningTechnologyBlueCyanWhiteAdventure MapMap MakingPvPSummoned mobsBlock building (fill/setblock/clone)SoundsLightning bolts21+ commands
The High-Voltage Perimeter creates a defensive electric barrier between two heavy iron pillars. Bright blue and white plasma arcs crackle across the gap, lighting up the dark and guarding a villager bait target in the center of the stage.
As zombies march toward the villager, stepping too close to the energy beams triggers a violent electric discharge. The shock launches them backward in a burst of soul flames and sparks while applying a glowing effect.
/scoreboard objectives add c9_timer dummy/fill ~-6 ~-1 ~-5 ~6 ~-1 ~4 polished_deepslate/fill ~-5 ~ ~-1 ~-5 ~3 ~-1 iron_block/fill ~5 ~ ~-1 ~5 ~3 ~-1 iron_block/setblock ~-5 ~4 ~-1 sea_lantern/setblock ~5 ~4 ~-1 sea_lantern/summon villager ~ ~ ~2 {NoAI:1b,Silent:1b,Invulnerable:1b,Rotation:[180f,0f],Tags:["c9_bait","c9_ent"]}/summon marker ~ ~1 ~-1 {Tags:["c9_ctrl","c9_ent"]}/summon marker ~-2.5 ~1 ~-1 {Tags:["c9_node","c9_ent"]}/summon marker ~2.5 ~1 ~-1 {Tags:["c9_node","c9_ent"]}/execute as @e[tag=c9_ctrl] run scoreboard players add @s c9_timer 1/particle dust_color_transition{from_color:[0.0,0.5,1.0],to_color:[1.0,1.0,1.0],scale:1.6} ~ ~1.0 ~-1 2.4 0.05 0.05 0 30 force/particle dust_color_transition{from_color:[0.1,0.8,1.0],to_color:[1.0,1.0,1.0],scale:1.6} ~ ~2.0 ~-1 2.4 0.05 0.05 0 30 force/particle dust_color_transition{from_color:[0.0,0.5,1.0],to_color:[1.0,1.0,1.0],scale:1.6} ~ ~3.0 ~-1 2.4 0.05 0.05 0 30 force/particle electric_spark ~ ~2.0 ~-1 2.5 0.8 0.15 0.2 35 force/execute if score @e[tag=c9_ctrl,limit=1] c9_timer matches 20.. run scoreboard players set @e[tag=c9_ctrl] c9_timer 0/execute if score @e[tag=c9_ctrl,limit=1] c9_timer matches 1 run playsound block.beacon.ambient master @a ~ ~2 ~-1 1 1.8/execute if score @e[tag=c9_ctrl,limit=1] c9_timer matches 1 unless entity @e[tag=c9_zomb,distance=..15] run summon zombie ~-2 ~ ~-4.5 {Tags:["c9_zomb","c9_ent"],equipment:{head:{id:"minecraft:iron_helmet",count:1}}}/execute if score @e[tag=c9_ctrl,limit=1] c9_timer matches 10 unless entity @e[tag=c9_zomb,distance=..6] run summon zombie ~2 ~ ~-4.5 {Tags:["c9_zomb","c9_ent"],equipment:{head:{id:"minecraft:iron_helmet",count:1}}}/execute at @e[tag=c9_ctrl] as @e[tag=c9_zomb,distance=..2.6] at @s run tag @s add c9_zap/execute at @e[tag=c9_node] as @e[tag=c9_zomb,distance=..2.6] at @s run tag @s add c9_zap/execute as @e[tag=c9_zap] at @s run particle soul_fire_flame ~ ~1 ~ 0.4 0.6 0.4 0.15 40 force/execute as @e[tag=c9_zap] at @s run playsound entity.lightning_bolt.impact master @a ~ ~ ~ 0.5 1.8/execute as @e[tag=c9_zap] at @s run damage @s 7 lightning_bolt/execute as @e[tag=c9_zap] run data merge entity @s {Motion:[0.0,0.42,-0.85],Glowing:1b,Tags:["c9_zomb","c9_ent"]}/execute as @e[tag=c9_zomb] unless entity @s[tag=c9_zap] run data merge entity @s {Motion:[0.0,-0.1,0.14],Glowing:0b}loop #2 Draws the bottom electric beam between the two pillars using <code>dust_color_transition</code> particles that shift from bright blue to white.loop #8 Spawns a helmeted zombie in front of the fence whenever the stage is clear, ensuring a steady stream of test targets.loop #10 Checks around the invisible marker nodes placed along the beam and tags any zombie that steps within 2.6 blocks with <code>c9_zap</code>.loop #14 Applies 7 points of lightning damage to any tagged zombie and plays a high-pitched thunder sound.loop #15 Modifies the zombie's <code>Motion</code> NBT to throw it backward and upward while clearing the <code>c9_zap</code> tag.


Recorded on our own test server: 60 frames at about 9.9 fps. Our image check saw: Three horizontal beams of blue and cyan particles span between two iron pillars with sea lanterns, with white death smoke particles appearing where a mob was zapped near a villager.
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 barrier to defend your base against all hostile mobs instead of just the demo zombies, remove loop commands 8, 9, and 16, and replace tag=c9_zomb in the detection commands with type=#minecraft:raiders or type=!player,type=!villager,type=!marker so any monster crossing between the pillars gets shocked.
/kill @e[tag=c9_ent]/scoreboard objectives remove c9_timer/fill ~-6 ~ ~-5 ~6 ~5 ~4 air/fill ~-6 ~-1 ~-5 ~6 ~-1 ~4 grass_blockThe helmets protect them from burning in daylight if you test the perimeter during the day, and they look like armored test subjects.
Yes. Move the iron pillars further apart in the setup commands, summon extra c9_node markers along the line, and increase the X spread value on the particle commands.
/damage/data/execute/fill/particle/playsound/scoreboard/setblock/summon/tag
▶High-Voltage Laser Security FenceShapes & GeometryEasy24 cmds
▶Spherical Repulsor BarrierShapes & GeometryMedium24 cmds
▶Ferrofluid Magnetic Spike Dance SculptureShapes & GeometryHard23 cmds
▶Kinetic Raindrop Matrix Sculpture Shape-ShifterShapes & GeometryExpert24 cmds
▶Spinning Crookes Radiometer Light MillShapes & GeometryMedium23 cmds
▶Acoustic Chladni Plate Sand ResonanceShapes & GeometryExpert24 cmds