How to make random command block generators for 1.8.6
This handy tutorial shows you how to convert a dispenser that shoots out random command blocks into one that works for version 1.8.6 and up!
First, if you have a random command block generator from a dispenser like here:
Before 1.8.6 dispensers placed command blocks, and they would activate if placed next to a redstone block. But as of 1.8.6, this no longer works.
There is a way you can easily convert such a dispenser to work in 1.8.6 and up!
First, you need to use a spawn egg of a mob (I’ve used rabbits here because they’re passive), and get one egg for each command block in your dispenser. Then rename the eggs ‘Name1,’ ‘Name2’ and so on. Of course, you can use a different name but I’m just using Mob1 and numbering them for simplicity.
Take the command blocks out of the dispenser and into your inventory (you’ll need them later) and put the spawn eggs in.
Once you have replaced all the command blocks in the dispenser with spawn eggs, you need to place a repeater pointing away from the wiring (so it delays after spawning a random spawn egg. Make sure it’s on full delay – for some reason it doesn’t work on one tick delay) and then extend more redstone wire like what is shown here:
Then place the command blocks from the dispenser where shown. If you're starting from scratch, these are the command blocks that are randomly chosen, so put in all your commands that you want. Now you need to paste the following command into the command blocks BEFORE your command:
/execute @e[type=Rabbit,name=Mob1] ~ ~ ~ like so:
Now, the dispenser will choose a randomly named mob and spawn it. Then, for the command blocks that come after, it will execute from whichever named mob it spawned. In my example, if the dispenser chooses Mob1 it will spawn a Zombie Pigman. If it chose Mob3 it will spawn a Creeper.
After the command blocks you should put another repeater that leads to a command block that kills the rabbits (or whatever mob you used) and their drops so they don’t lag up your world or get executed from again if the wiring is going to get activated again (as you'll see in the 'extras' section).
That’s how you get random command block dispensers in 1.8.6!
Extra: Getting them to work over and over again:
If you want it to spawn a random mob every (say,) five seconds, what you do is extend the redstone repeaters around like so:
Use control-pick block key to pick up the dispenser with its NBT data and place it somewhere else not next to wiring, and make sure it’s still facing the same direction. A repeater before the dispenser, put in a command block that clones the new dispenser to the dispenser next to the wiring. Now it will reset the dispenser for each new time so it never runs out of spawn eggs!
Remember to make it kill the rabbit spawned each time it goes around after the command blocks execute from the rabbit!
This is so it doesn't execute from it again along with whatever other random rabbit it chose.
Extra: Other commands
Simple! It doesn't have to spawn random mobs - the command blocks can do anything (like say a random message, or give you a random item, etc). Just make sure the /execute part goes before the main command that you want.
How to make random command block generators for 1.8.6
This handy tutorial shows you how to convert a dispenser that shoots out random command blocks into one that works for version 1.8.6 and up!
First, if you have a random command block generator from a dispenser like here:
Before 1.8.6 dispensers placed command blocks, and they would activate if placed next to a redstone block. But as of 1.8.6, this no longer works.
There is a way you can easily convert such a dispenser to work in 1.8.6 and up!
First, you need to use a spawn egg of a mob (I’ve used rabbits here because they’re passive), and get one egg for each command block in your dispenser. Then rename the eggs ‘Name1,’ ‘Name2’ and so on. Of course, you can use a different name but I’m just using Mob1 and numbering them for simplicity.
Take the command blocks out of the dispenser and into your inventory (you’ll need them later) and put the spawn eggs in.
Once you have replaced all the command blocks in the dispenser with spawn eggs, you need to place a repeater pointing away from the wiring (so it delays after spawning a random spawn egg. Make sure it’s on full delay – for some reason it doesn’t work on one tick delay) and then extend more redstone wire like what is shown here:
Then place the command blocks from the dispenser where shown. If you're starting from scratch, these are the command blocks that are randomly chosen, so put in all your commands that you want. Now you need to paste the following command into the command blocks BEFORE your command:
/execute @e[type=Rabbit,name=Mob1] ~ ~ ~ like so:
Now, the dispenser will choose a randomly named mob and spawn it. Then, for the command blocks that come after, it will execute from whichever named mob it spawned. In my example, if the dispenser chooses Mob1 it will spawn a Zombie Pigman. If it chose Mob3 it will spawn a Creeper.
After the command blocks you should put another repeater that leads to a command block that kills the rabbits (or whatever mob you used) and their drops so they don’t lag up your world or get executed from again if the wiring is going to get activated again (as you'll see in the 'extras' section).
That’s how you get random command block dispensers in 1.8.6!
Extra: Getting them to work over and over again:
If you want it to spawn a random mob every (say,) five seconds, what you do is extend the redstone repeaters around like so:
Use control-pick block key to pick up the dispenser with its NBT data and place it somewhere else not next to wiring, and make sure it’s still facing the same direction. A repeater before the dispenser, put in a command block that clones the new dispenser to the dispenser next to the wiring. Now it will reset the dispenser for each new time so it never runs out of spawn eggs!
Remember to make it kill the rabbit spawned each time it goes around after the command blocks execute from the rabbit!
This is so it doesn't execute from it again along with whatever other random rabbit it chose.
Extra: Other commands
Simple! It doesn't have to spawn random mobs - the command blocks can do anything (like say a random message, or give you a random item, etc). Just make sure the /execute part goes before the main command that you want.
Thank you for reading!