I have created a large zombie pigman gold farm in the Nether.
But, the magma cubes are killing production. If I leave for more than a day, I get zero production, because there are magma cubes all buried under the lava. I have a plan to deploy cactus judiciously around their drop off points and that will keep them from congregating under the lava.
However, I'd like to build a rail station at the base of the farm, and I cannot figure out how to keep the cubes from spawning around / on the train tracks. I was hoping to avoid having to cactus the track for the entire route, as that would require massive amounts of sand and cacti. I was hoping for a more ... efficient solution. Perhaps to both problems?
41 Answer
There's an oddity in monster spawning you can exploit. As is well known, mobs can spawn on top of any block with a flat, opaque top surface, even if there is a non-solid block such as a torch or rail on top of that block.
However, the selection of center points for groups (“packs” as Minecraft Wiki describes them) of mobs is slightly different: it requires that there be empty space which is an air block, nothing else (not even a torch). Only once such a point has been found will mobs spawn with their feet at that level in the area around that point.
Therefore you can prevent spawning entirely as follows: make sure that in the vicinity (up to 20 blocks horizontally) of your rail station, at any particular y-level, either there are no empty air blocks, or at the y-level below it there are no regular valid spawning surfaces.
For example, consider this cross-section of an underground rail tunnel.
5 ######### _ slab
4 ### ### # stone/netherrack
3 ### ### R rail
2 ###R_R###
1 #########No mobs can be spawned in the middle of a tunnel of this form:
- No mobs will spawn with their feet at levels 4 or 3 because there are no solid blocks below those levels (all individual spawn locations are invalid).
- No mobs will spawn at level 2 because there are no air blocks at that level (all pack spawn locations are invalid).
However, if there are any air blocks at level 2 within 20 blocks of the tunnel, then they may cause spawning. So, if the tunnel is in midair as such things often are in the Nether, you'd have to build a 20-block-wide flange beside the tunnel at level 2 to prevent spawns (preferably made of slabs so as not to itself be a spawning platform).
Disclaimer: I've never tried to engineer spawns in this way; I'm just going by others' documentation of the way it works. (And yes, this was already mentioned in the comments of this question; but answers should be posted as answers, and I felt a fuller explanation would be useful.)
1