This is designed for the attracting and killing zombies while being able to fire repeatedly and still being able to trade with the villager. This is most effective at night, and will only work against zombies. This is a good food source due to the rotten flesh, carrots, and potatoes. This is my first post, so please don't be upset if it doesn't work like you expected.
Step 1: Make the Base
You don't need netherrack or quartz, i just used them to (very horribly) resemble a Ghast.
Step 2: Place the Cannon and Anti-lava Blockage
Place a Dispenser facing inwards, then place a Fence Gate on the other end. Open the Fence Gate.
Step 3: Make the Trigger
You will have to "crouch" for this one. Unless you changed the key, press shift to crouch. Anyways, crouch then place a Button on the back of the Dispenser.
Step 4: Place Lava
Place the lava in between the Dispenser and the Fence Gate. DEATH WARNING!!! Either drink a Fire Resistance Potion or be VERY careful!
Step 5: Load the "cannon"
Give yourself 9 64 stacks of arrows and fill up the Dispenser.
Step 6: Make a Roof/second Floor
Make a 3x3 square of whichever material you want with the center block over the lava.
Step 7: Make the Villager Capsule
Use the glass and make a "capsule" as seen in the picture above, with a one block hole at eye level from above the quartz so you can still trade with the villager.
Step 8: Spawn the Villager
Spawn the villager, it doesn't matter what kind. I would go with either a librarian or a butcher, because in the 1.8 update, the farmer villagers actually farm crops.
Step 9: Make the Wall
Make a wall with the same material you used to make the floor, so you don't get attacked by mobs while you are trading.
Step 10: Make the Stairs to the Trading Center
Make the stairs, again, it doesn't matter which kind you use. I prefer to use stone brick, but it's for you, so use whichever kind you want.
Step 11: Make the Stairs' Wall
So you don't fall or get attacked, make a wall surrounding the stairs.
Step 12: Make the Door
I used a Fence Gate for the door because zombies won't beat it down like they would with regular doors. Again, It's your choice.
Step 13: Surprise, You're Done
You have finished the zombie magnet/killer. You can add torches and a path to the targeting zone for better protection or aim, if you want, but you are done with all the important stuff. Yes, this is my minecraft skin. I will be changing it because it is copying SSundee's intros.