In the last post, we looked at the basic principles behind building a secret door into a staircase. This kind of secret door uses what is called a piston extender. In the interest of brevity and clarity, we left the project with a working button triggering mechanism inspired by MrCubey’s secret door design. Today, however, we are going to replace that button triggering mechanism (the first part, at least) with a triggering mechanism that detects the presence of a key item. But first, I want to talk about pulse generators.
To make a piston extender work, you have to realize that it happens in two stages. The first stage, getting the pistons to extend and push a block two blocks away, is no problem. Simply apply a redstone signal and just make sure it is getting to all three blocks that it needs to get to. The problem comes in the second stage, when you try to pull that block back two blocks. Why is this a problem? Timing.
As you are probably aware, a Minecraft sticky piston cannot pull certain things, including an extended piston. So retracting a piston extender happens in three parts.
- The top piston (assuming a vertical piston extender going up) retracts, pulling the block.
- The bottom piston retracts, pulling the top piston but NOT the block.
- The top piston extends then retracts, pulling the block again.
Part three is where redstone designers come up with all sorts of cool solutions. The simplest ones simply work with delays in the original redstone signal through repeaters. Others involve creating a secondary redstone pulse – a blip of redstone activity (not a solid “On” signal). Fortunately, for this purpose there are redstone constructs called pulse generators.
The redstone on the right side of the input block is actually a compact pulse generator.
When the block below the dropper receives a redstone signal, it will place the cobblestone in the hopper, causing the comparator to emit a redstone signal for just an instant (before the hopper feeds the item back into the dropper). Even if the input is solid, this pulse generator will only produce a single pulse. The redstone signal will have to turn off and on again before it will produce another pulse.
There are actually a lot of different kinds of pulse generators. A button is actually a pulse generator, but it requires manual operation. What a pulse generator does is turn a solid redstone signal into a pulse, making a lever produce button-like redstone behavior.
This is a good example of a basic, if not particularly elegant, pulse generator. The repeater on the right has a longer delay than the repeater in the center of the image. This makes it so that when the lever is turned OFF, there is short period during which the block on the right is not powered, allowing the redstone torch and the lamp to blink on. If you set the center repeater to 4 ticks and the right repeater to 1 tick, the pulse happens when you turn the lever ON.
Here is one example that I really like because you can customize the length of the pulse (make it shorter or longer). Take note of this, because it comes into play in just a little bit.
A picture of a 1-wide dropper latch pulse extender. This contraption can be turned at right angles at the second dropper and at the comparator next to the second hopper.
These two dropper face each other, and a single piece of something is placed in the one on the left. When the redstone signal turns on (lever or button), the piece of something (cobblestone) moves from the left to the right dropper.
A comparator behind the right dropper detects the presence of the cobblestone and sends a redstone signal to a sticky piston connected to a redstone block.
The redstone block sits above a pair of hoppers that face each other. The left hopper contains any number of items (the more items, the longer the pulse will be extended). The redstone block keeps the left hopper from sending items into the right hopper. When the piston extends, items can flow to the right, but not to the left.
A comparator next to the left hopper emits a redstone signal by default (since items start in the left hopper). This depowers a redstone torch sitting under the right hopper. When all items have filtered into the right hopper, the comparator turns off, powering the torch, activating the dropper and sending the piece of whatever back into the left dropper, turning off the comparator next to the right dropper, causing the piston to retract and items to flow back into the left hopper.
Finally, a comparator next to the right hopper emits a redstone signal when the hopper starts to receive items from the left hopper until it empties all those items back into the left hopper.
For more information about pulse generators, check out http://minecraft.gamepedia.com/Pulse_circuit.
Opening the Secret Door With a Key
If you watched the video above, you will have seen that the way I open up my secret door is by tossing an item onto the ground in front of the staircase. The item disappears, and if I have tossed the incorrect item, the item gets spat back out at me. If I have tossed the correct item, the door opens, and I receive the item back inside the secret room. So how does this work?
Step 1: Receiving the Item Through the Floor
You’ve probably already figured this part out. While a hopper can receive an item through a slab on the bottom half of a block, a hopper minecart can suck an item right though a full block.
You can place a rail on top of a hopper. Any cart placed on this rail will drain its contents into the hopper.
Place a hopper cart on the rail. I put blocks around the cart to keep it from drifting away.
The polished granite block sits directly above the hopper cart. Now, any item tossed onto the granite block will disappear and makes its way into the chest below.
Here’s what it looks like under the secret door platform. The quartz block above this rail is two blocks in front of the stairs.
Before placing the rail and the cart, make sure the hopper they will sit on is point at another hopper (as pictured). It needs to be pointed sideways (away from the side with the piston extender input).
The outline block is the one you want to target with your dropped items.
Step 2: Filter the Item
Next, we need to detect whether the item thrown was the correct key item. This is done using a hopper filter. Here’s how it works.
Reaction 1: Incorrect Item
First, create the “incorrect item” path. If the item tossed on the ground is not the right item, it is rejected by the hopper filter and goes through a hopper chain into a vertical dropper chain. This is automatically triggered and is sent through the block the player is standing on into his or her inventory.
Place two droppers (both facing up) two blocks back from the hopper cart (away from the stairs).
The droppers must face upward. Put a ground block (here quartz) on top of the upper dropper. The dropper chain will toss the item through the ground into the player’s inventory.
Create a hopper chain that leads into the bottom dropper. The leftmost hopper in the picture is the one with the hopper cart on top of it.
Finally, create a redstone array like this one to cause of comparator clock to send a pulse into the dropper chain whenever an item enters into it. This will send the item back up to the player without opening the door.
Reaction 2: Correct Item
If the item is the correct item, a hopper filter will receives the item.
Under the hopper holding the cart and rail, place another hopper that points to the side. Place a comparator behind it. This is your filter hopper.
Set up some redstone like this. This setup will cause the redstone torch to depower once the filter hopper has a certain number of items in it.
Above the redstone torch and below the filter hopper place a hopper that leads into another hopper chain. We’ll finish this hopper chain later. When the torch is powered, this bottom hopper will not receive items from the filter hopper.
Finally, we want to prepare the filter hopper (the middle hopper next to the comparator). In Minecraft 1.10, you will need 22 of your key item (18 in the first slot, 1 in each of the other four) if your item goes into stacks of 64. You will need 5 of your item if they stack in groups of 16 (like eggs, for example). The numbers used to be a little different. Don’t bother trying to do this with items that don’t stack. Also, you will have to operate the door one time before it starts returning items to you (or you can put another of the key item into the bottom hopper).
This will cause two things to happen:
- Trigger a redstone pulse that opens the secret door;
- Send the key item into a different hopper/dropper network that returns the key item to the player inside the secret room.
Step 3: Trigger a Redstone Pulse
We’ve already built the door mechanism in the last post. Now all we need is a redstone pulse of sufficient length to open the door and keep it open long enough for us to get inside before closing again. This is where the pulse generator I was talking about earlier comes in.
Place another repeater away from the back-most block of the hopper filter array. When an item passes through the hopper filter (i.e., a correct item was dropped), a brief redstone pulse will cause this repeater to activate for just an instant. Fortunately, that instant is all we need. We just need to extend it.
Send that repeater into a block. Now we build the Dropper Latch Pulse Extender from earlier, with one minor change. Remember that these droppers face each other. Also remember to put a piece of cobblestone in the first dropper.
Here is the change, and we’ve already talked about it: turn a corner toward the piston extender array under the second dropper, like this.
Continue the build just as pictured earlier. Remember that is a sticky piston. Also remember that the hoppers must face each other, and a few items must be placed in the left hopper. I recommend 4 or 5 items.
Finish the pulse extender and send the signal into a series of redstone torches, blocks, and a repeater as pictured. The repeater sends a signal into the piston extender input block.
What this does is cause the door to open for the length of time the pulse extender activates. If you want to door to stay open a little longer, add an item or two to the left hopper.
Step 4: Return the Item to the Player
When the hopper filter receives the key item, it passes through the filter into another chain of hoppers and droppers. This spits the item back out to the player inside the secret room.
Extend the hopper chain at the bottom of the hopper filter over to a new upward facing dropper chain. It should lead into a floor block that sits inside the secret room.
Again, make a comparator clock setup to activate the dropper chain and send any item received into it back up to the player who is now inside the secret room.
Step 5: Getting Back Out
Here you have options. I originally designed my room to have one way in and another way out. Both are concealed, but differently. If you want to go back out the way you came in, there are any number of solutions, but the simplest is probably just to use the button method from the last post. Use the key item to get in, and use a button to get out. Piece of cake.
This build was a lot of fun for me to design. I love it when you can string together a lot of simple redstone concepts into a much larger device, like a Rube Goldberg machine. This secret door design uses several basic items and simple redstone devices – pistons, piston extenders, pulse generators, a hopper cart, hopper filters, hopper chains, and dropper chains – to produce something really fun and maybe a little functional.