How can I protect my Iron Farm villagers from lightning?

I am building an iron golem farm in the spawn chunks, and there is the problem of witches spawning in the villager cells, and that would break the iron golem farm. Bummer.
So, reading the wiki, I learned that
When lightning is to strike, random X and Z coordinates within the chunk are chosen, and the block just above the highest block that is liquid or blocks movement is chosen for the lightning strike. Then if there are any living entities that can see the sky in a 3×3×h region from 3 below the target block up to the world height, one such entity is selected at random and the lightning target is moved to the block the entity is standing in.
The target block is checked again for the following conditions:
- Target block can see sky.
- Rain (not snow) is falling in the target block.
If these conditions pass, lightning strikes.
When lightning strikes, all entities within a 6×6×12 region horizontally centered on the northwest corner of the target block with the bottom edge 3 below the target block are struck by lightning.
So basically if I put a roof over the villager cell, they should be safe, but I think that x12 on the last paragraph is height. Also it only targets entities if they can see the sky.
How should I build the roof to protect the villagers? How broad and how far high over them?
Related questions, none of the answers solve my particular issue, as I only need to protect the 4x4 area where the villagers will stand in.
(asks about fire-proofing buildings) How to lightning-proof a structure?
(asks about protecting the player) Preventing Lightning in Minecraft
(also about buildings) How can Buildings be Made Fireproof?
Best Answer
First you must create a very fast redstone clock and make power a command block with this command inside:
/kill @e[type=Lightning]
This will kill lightning before it can strike because in the 1.8 update lightning became an entity and also allow you to use entity commands using @e or entitydata but the clock must be very fast as lightning takes about 2 game ticks to hit the surface.
The best option is by using one of the fastest and simplest command block clocks
To set up the clock you must first set up a command block type in
/setblock ~ 1~ ~ redstone_block 0 destroy
Then place a block of stone on top of the command block then on the top of the stone place another command block with this command inside:
/kill @e[type=Item,r=2]
Warning:do not take out the r=2
or all items will be deleted constantly.(r=radius)
Now replace the stone with a redstone block finally place the kill lightning command block beside the redstone block now you are complete.
Pictures about "How can I protect my Iron Farm villagers from lightning?"



Quick Answer about "How can I protect my Iron Farm villagers from lightning?"
How do you protect villagers from lightning in Minecraft?
The Lightning Rod is one such item, and players can use it to protect themselves, their homes, and even friendly Villagers and other players.What happens if lightning strikes a villager?
When a villager is struck by lightning in Minecraft, the villager is transformed into a witch.Can villagers go through lightning rods?
Just put a villager in a tiny space with a Lightning Rod in the middle, and wait for it to be struck. It's a bit mean, but effective. Remove oxidation from copper blocks. Just place the Lightning Rod on top of the copper and wait until it gets hit; the greenish color will disappear.What block in Minecraft attracts lightning?
The rod will attract lightning to its location in a 128-block radius in Bedrock Edition. In addition to lightning rods, copper ingots can be used to create copper blocks.Lightning protection Gnembon's Iron farm. 1.16 Java
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Anete Lusina, Sergey Makashin, Anete Lusina, Griffin Wooldridge