Buttons and Levers
A button/lever directly on a command block (hold shift while placing the button).
A regular block with a button/lever on any side that's connected to a command block.
An underground command block with a regular block on top of it that has a button/lever on any side.
A regular block with a button/lever, with a line of redstone dust that leads to a command block.
Pressure Plates
A pressure place on top of a normal block, with a command block underneath the block.
A pressure place directly on top of a command block (hold down shift to place it).
A pressure place with a trail of redstone dust that leads to a command block.
Tripwires
A command block to one side of a tripwire line (make the "trap" with two tripwires and a line of string between them).
A command block underneath a block with a tripwire.
A tripwire with a line of redstone dust that leads to a command block.
Targets
A target with a command block directly attached to it. To activate a target, shoot an arrow with a bow onto it.
A target with a trail of redstone dust that leads to a command block.
Redstone Torch
A redstone torch with a trail of redstone dust leading from it to a command block.
A redstone torch right next to a command block.
Here I have two plank blocks in a wall to represent a hidden doorway. The button to the left is connected to a command block.
The command block has a fill command inside of it. The numbers are the coordinates of the two plank blocks. The fill command fills those blocks with air once the button is pressed, revealing the doorway.
A trap floor can be made using any activator - here I used a tripwire. The tripwire is connected to the command block. When the player walks across the tripwire, the fill command in the block activates, which fills the pink planks with air, causing the person to fall through the ground.
A command block can be activated when an item in an item frame is rotated by the player right-clicking on it.
Behind the item frame is a comparator (placed EXACTLY as seen above). Then, place a line of redstone dust that leads to a command block. When the item in the frame is rotated enough, it increases the signal strength until it’s strong enough to activate the command block.
A command block can be activated when an empty cauldron is filled.
The cauldron needs a comparator behind it, placed exactly as seen above (the side with two “torches” should be against the cauldron). Then, you need a line of redstone dust that leads to the command block.
This is not a normal chest - it is a trapped chest.
If the chest is connected to redstone dust or a redstone device, opening the chest will send a signal, which activates the redstone.
The /testfor command can be used in a command block to check if a player has a certain item in their inventory. Then, if a second (chain) command block is attached to the one with the testfor command, an action/command will happen only if the player has that item.
In the example below, the first (orange/impulse) command block tests to see if the player has zero diamonds in their inventory (item=diamond, quantity=0) when they press a button connected to the orange command block. If the player presses the button and they do not have diamonds, the second (teal/chain) command block gives them exactly one.
If they player had pressed the button and they already had a diamond in their inventory, nothing would happen.
This goes in the first command block (the orange one).
***NOTE***: Command blocks chained together MUST have their arrows facing the same direction. Also, the chain (teal) block settings on the left must be changed to chain, conditional, always active.
These are the setting and an example command for the second command block (the teal one). You can put any command that you want to happen in this one.
Some ideas for the /testfor command:
If the player has a certain number of items, fill an area with air to reveal a hidden pathway.
If the player has a certain number of items, give them a different item.
If the player has a certain number of items, the player teleports to another area.
If the player has a certain number of items, show text on screen.
If the player has a certain number of items, an effect (like levitation or blindness) happens to the player.
Another type of test for command is /testforblock. This command checks to see if a certain type of block has been placed in a certain spot.
In this example, the /testforblock command is checking to see if a gold block has been placed at coordinate -9 -60 16 (which is on top of the gray block in the picture.
If the player has placed the gold block in that spot and then presses the button, the second chain block will then give the player a lever. If a gold block has not been placed, nothing will happen.
This goes in the first command block (the orange one).
***NOTE***: Command blocks chained together MUST have their arrows facing the same direction. Also, the chain (teal) block settings on the left must be changed to chain, conditional, always active.
These are the setting and an example command for the second command block (the teal one). You can put any command that you want to happen in this one.
Here we have an entryway that is blocked by two sticky pistons that have blocks attached to them (the pink ones).
The pistons have redstone dust leading away from it, and it leads to a redstone torch that is on a side of a block that has a lever on it.
This is a reverse redstone signal device. This means that the redstone is activated (which pushes the pistons out), and when the lever is clicked, it turns the redstone off, which pulls the pistons and blocks back.
Here I have a command block, set to the repeat type, which will summon a mob every 200 “ticks.” In Minecraft, 20 ticks=1 second. So, 200 ticks=10 seconds, becase 20 x 10 = 200.
When the lever is activated, a cat will spawn every 10 seconds in the location that is listed in the command coordinates.
Below is a setup where there's a pressure plate connected to a short line of redstone dust. Then, there is a long line of redstone repeaters that lead to a command block, then more repeaters that lead to another command block.
The repeaters have two main functions: they can increase the strength of a redstone signal, or, they can delay a redstone signal.
Here, I have them used to delay the signal. Once someone steps on the plate, the command block will not activate instantly - it will take a few seconds for the signal to reach the command block.
You could have multiple commands blocks separated by more repeaters (which I have in this example) and each will activate after the delays.
In this video, I've created a trap where when a player is falling through the air, they fall through a tripwire, which is connected to command blocks.
You'll need tripwire, string, regular blocks, and command blocks. Place the regular blocks in the air (I do this by building a line of blocks from the group up and then breaking the extras), then put command blocks on the sides of each one with whatever commands you want.
Then, on the "inside" of the blocks, put a tripwire. Then, connect the tripwires using string.
When the player falls from above, they will fall into the wire, which activates the command blocks.
In this video, I made what's called a redstone "clock" which loops a signal again and again and activates command blocks as it "moves."
You can make many things happen in a loop like this, but in this example, I have a pool of lava repeatedly appear and disappear.
The video can show you how to set this up better than I can explain in words. Some things to keep in mind as you watch: the redstone repeaters must be placed in a specific setup, and when you go to place the redstone torch, you must place it and then immediately destroy it for the clock to work.
One way to make a mob battle arena is to have a pressure plate (or whatever trigger you want!) that activates a chain of command blocks.
The first command block must be an orange impulse command block. I like to put a title command in the first one with words that show up on screen, but you could do any command you want (maybe give the players an item, or put an effect on them, etc.).
Then, the other blocks are chain command blocks. Each one summons a mob at a specific location. I had all my blocks spawn spiders in one spot, but you could have each command block have a different mob, or put them in different spots.
With the chain command blocks make sure that you change the block time to chain, the condition to conditional, and the redstone to always active.
As always with chain command blocks, make sure the arrows on the blocks all face the same direction. You can to this by walking backwards as you place them.
Let's say you have bees in a room. You want players to kill the bees, but, you want something to happen once they're all gone.
On the left I have some bees in a room. You can use any mobs you want!
Somewhere else nearby you'll need to create the setup shown below. I like to put my command blocks directly underground.
The first block is set to the repeat type, and I've changed the "redstone" category to always active.
In the command line, type in the command: /testfor @e[type=bee,r=15]
If you have a different type of mob, change "bee" to whatever the mob type is. The r=15 is the area radius the command block will check for bees. In my example, the block is searching for bees in a radius of 15 blocks in every direction.
Up against the repeat command block is a comparator. The side of the comparator that has two "sticks" must be placed up against the command block.
Then, place a one-block line of redstone dust. After that, place any normal block. On the other side of that normal block, place a redstone torch. Then, beside the torch, place another command block. In the orange command block put the command for what you want to happen when all the mobs are destroyed.
The logic for this setup is this: The first command block searches for bees and finds them, so the comparator is activated. But, because a redstone torch is always lit by default, the comparator does the opposite and causes the torch to shut off.
When the bees are destroyed, the comparator will deactivate because it can no longer detect that mob, which then reactivates the redstone torch, which then activates the orange command block.
You can create a scoreboard in Minecraft, so that you can give players points for certain things (like hitting a target, getting to the end of an area, answering a question correctly, destroying a mob, etc.). Then, you can make it so they can only beat the game if they have a certain number of points.
First, you'll need to type a couple commands in the TEXT area, not in command blocks.
/scoreboard objectives add score dummy Score
This one creates the score objective. Notice the score is written twice: the first "score" is the name of the score command, and the second "Score" is what will show on the screen for players (which is why I capitalized it). "Dummy" in coding just means it's a category.
2. Then, you need to put a command in the text area to create a scoreboard that shows onscreen:
/scoreboard objectives setdisplay sidebar score
3. Then, add future players. In the text area, enter this command:
/scoreboard players add @a score 0
The 0 sets everyone's starting score at 0.
4. Now you'll need to decide how players are earning points. Are they pressing a button? Hitting a target? Answering a question correctly? You decide! No matter what, a command block will be needed to add a point or points to the player's score. Wherever you place the command block, it'll need this code inside of it:
/scoreboard players add @p score 1
If you want them to get more than 1 point you can change the number in the command.
5. Now, at the end of your game you might want players to have a certain number of points before they can finish it. To do that, you'll need a couple of command blocks chained together, with some sort of trigger (button/lever/pressure plate/etc.). In the first command block (the orange impulse one), enter this code:
/testfor @p [scores={score=5}]
This checks to see if the player has exactly 5 points. If they do, the next command block chained to it will activate. If not, nothing happens.
In the next command blocks chained to it (remember, chained blocks are blue and need to have their arrows pointing the same way as the orange one) you can put commands for whatever you want to happen. Maybe if they have the required points they teleport to an ending area.