How can I make an automatic door that opens for me only?
I'm trying to make a house with an iron door that will open for me when I'm next to it (it stays closed for anyone else). Is this possible with a command block? How would I do it?
Best Answer
Into the command block put this command:
testfor @a[x=X,Y=Y,z=Z,r=R,name=NAME]
X
, Y
and Z
are the door coordinates (lower half), R
is the radius of the testing area in blocks (for an equivalent to a pressure plate put 1
) and NAME
is your username.
All repeaters are set to minimum delay, esp. the clock on the right. Under the door is a Redstone torch. This will only work with the comparator - MC 1.5+.
Pictures about "How can I make an automatic door that opens for me only?"
How do you make a self opening door?
An automatic door, also known as an auto door, is a door that opens automatically, usually on sensing the approach of a person.How to Make Automatic Door Opening Using Arduino and PIR Sensor | Automatic Door Opening System
More answers regarding how can I make an automatic door that opens for me only?
Answer 2
Since the device is fairly complicated on the redstone, here's a picture:
(Image taken by me)
In the command block, put
testfor @a[r=5]
(Replace 5
with the number of blocks you want a player to be away from the command block until it fires)
Here's a side-by-side comparison to break the command down:
testfor Powers the redstone repeater if the next part evaluates to true
@a Targets all players
[r=5] Narrows 'all players' down to 'all players within a 5 block radius.
To sum up the image: First, the redstone clock (left) should be started. Just place a redstone torch on one side of the repeaters and break it right after.
Then, the command block will be repeatedly queried whether or not there is a player in a 5-block radius. If there is, the comparator will power, the repeater will fire, it will go down to the redstone, through the bottom repeater and power the door.
P.S. You'll probably want to cover up all that redstone. P.S. You'll probably not want to use sand and wool; pick blocks which suit your needs.
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Max Vakhtbovych, Athena, Khoa Võ, Lazaro Rodriguez Jr