Arqade Asked by ThoanSnow on April 24, 2021
I came to this website to find some answers how to lock a door with commands for my minecraft horror game. I was pretty aware that this method only works for 1.8, but now I’m curious if there’s any other commands that can be used to lock a door for 1.12.2 or higher.
You can do this by using invisible armor stands that blocks the door so they can't right click it. So here are the steps for it.
Get the cordinates infront of the door.
Then use this command and change the X Y Z /summon armor_stand X Y Z {Invisible:1b,Invulnerable:1b,PersistenceRequired:1b,NoBasePlate:1b,NoGravity:1b,DisabledSlots:31}
.
Now you need to use decimals to block the hole door. So now reapet the second step but now write .2 - .4 - .6 - .8 ifront of the X or Z cordinate (depents on were it's facing) so etc:
/summon armor_stand X.2 Y Z {Invisible:1b,Invulnerable:1b,PersistenceRequired:1b,NoBasePlate:1b,NoGravity:1b,DisabledSlots:31}
If there is no roof over the door then you need to the exact same thing but now you need to add 1 to Y.
If you need to unlock the door, then place this command:
/testfor @a {SelectedItem:{id:"minecraft:ANYITEM",tag:{display:{Name:"KEY NAME"}}}}
In a reapiting always active command block and then place this into a condential chain, always active command block:
/kill @e[type=armor_stand,r=2]
IF YOU NEED DIFFRENT KEYS AND MORE KEYS, THEN NAME THE ARMOR STANDS BY ADDING THIS TO THE ARMOR STAND COMMAND CustomName:"Door1" And then use this command for the key:
/kill @e[r=2,type=armor_stand,name=Door1]
To get the key use this: /give @p minecraft:WHATEVER_ITEM 1 0 {display:{Name:Key Name}}
Example: We say that the cordinates infront of the door is 1460 4 -150. Then we do this.
First we summon the armor stands ifront of the door: /summon armor_stand 1460 4 -150 {Invisible:1b,Invulnerable:1b,PersistenceRequired:1b,NoBasePlate:1b,NoGravity:1b,DisabledSlots:31}
Now we do the this: /summon armor_stand 1460.2 4 -150 {Invisible:1b,Invulnerable:1b,PersistenceRequired:1b,NoBasePlate:1b,NoGravity:1b,DisabledSlots:31}
And reapet until 0.8. Then you add 1 On Y so it will be like this: /summon armor_stand 1460 5 -150 {Invisible:1b,Invulnerable:1b,PersistenceRequired:1b,NoBasePlate:1b,NoGravity:1b,DisabledSlots:31}
And reapet until .8 Now you have to give yourself the key and your done
Answered by Erram on April 24, 2021
/blockdata ~ ~-2 ~ {Lock:Key}
Yes, I'm using command for locking the door he opened if you open with item renamed "Key"
Answered by Zero10 on April 24, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP