How do I keep Endermen out of my mushroom farm?
Endermen cannot spawn (or teleport, or walk) into an area that is only 2 blocks high as they're 2.9 blocks tall. Therefore, just make sure that the roof of your "farm" is only 3 blocks above the floor. Source
Enderman don't like every type of block: you could just change the walls to something less attractive to them.
If you're playing 1.8.1, you only have a few options, including:
- Snow
- Glass panes
- Obsidian
- Furnaces
But if you play the 1.9 prerelease, fret not: Endermen's penchant for block stealing has been drastically nerfed. If you're building your room out of any normal material people use to build rooms, you don't have to do anything. Enderman will only take the following blocks in 1.9 and onward:
- Cactus
- Clay
- Dirt (grassy and regular)
- Flowers (red and yellow)
- Gravel
- Melon
- Mushroom (both kinds)
- Pumpkin
- Sand
- TNT
No mobs spawn on halfsteps or glass. So you can use halfsteps/slabs (not double steps) or glass in your walk areas and make sure that the growing areas don't have enough height for the enderman to spawn. You can also properly light and fence in the area outside your building, if it's freestanding, to prevent endermen from spawning inside the fence.
Also with the advent of melons it seems that mushrooms are obsolete as food now, unless you're going to be constantly moving for an absurd period of time...