Using this minecraft redstone schematic, you can add traps in minecraft that will go off when you stand on top of them! Rogueclownfish has made traps from Pixel Dungeon and ported them into minecraft.
Minecraft Tutorial - How to Create a Mob Trap and Item Collection Machine by drunkoncustard. Note that to speed up the process, this machine was created in Minecraft's Infdev mode.