Armable/disarmable dispenser traps in minecraft

I am building an automated castle gatehouse in minecraft featuring a corridor between two openable/closable doors where arrows will shoot anyone in the corridor; that can also be disarmed.

here is a diagram of the coridor with no autimation where d is door and - is wall:

-------
d     d
d     d
-------

My first version had dispenser machine guns along the corridor that could be fired with a switch - but the vast number of arrows they threw out slowed down my computer too much.

here is a diagram of the coridor with no autimation where d is door - is wall and a is arrow dispenser:

-a-a-a-
d     d
d     d
--a-a--

enter image description here

My second version used pressure pads along the coridor so that when one is stood on, the dispenser facing it will fire. I didn't get any kind of rapid fire working on the dispensers which i would have liked, but more significantly these traps couldn't be disarmed - essentially making the coridor useless for entering and exiting the castle.

here is a diagram of the coridor with no autimation where d is door, - is wall, p is pressure plate, and a is arrow dispenser:

--aaa--
d ppp d
d ppp d
--aaa--

enter image description here

I would like to build something that when switched on, will shoot at any mob in the coridoor, and when switched off will alow the coridor to be safely used.


Solution 1:

The way the pressure plates are in the corridor are powering the dispensers no matter what. It is recommended to place them at head level.


This solution works on JE and BE.

Solution Images

Minecraft Dispenser Trap Rear View Minecraft Dispenser Trap Front View

Solution Notes

  • This solution is single-sided. To implement the other side, simply build this design, and mirror it to the other side.
  • If your corridor is less than five blocks long, you will need to place redstone dust on top of the dispensers. This will be a problem if your corridor is three or more blocks high.
  • The lever is opposite what you have requested, ON is safe, OFF is deadly. Use a redstone torch to invert signal if coming from an auxiliary input device.
  • The comparator at the bottom must be switched to subtraction mode to work. To do so, right-click on it so that the torch at the front is lit.

Downsides to This Solution

  • You cannot disarm the trap while the pressure plates are activated. If you do, the arrows will keep firing forever.

How it Works

See how your Redstone Machine works so you can apply the principles to other builds!

  1. The input from the pressure plates runs into a comparator subtractor clock that rapidly pulses to fire arrows.
  2. Redstone Repeaters transmit the signal to the dispensers. Every powered dispenser will cause it and the adjacent dispensers to fire.
  3. Flicking the lever locks the repeater that sends the signal from the pressure plates, meaning it won't reach the clock, and so won't fire the arrows.

Next Steps

Here are some ideas that could come next. Try them out!

  • Add a light indication that indicates to players whether it's safe or armed, so that they know before they go.
  • Add dispensers from the ceiling.
  • Try using splash potions instead of arrows, or even tipped arrows/lingering potions!