6

I have searched this forum and the internet, but all the proposed solutions don’t work for one reason or another. Since someone removed the “Minecraft PE” part of my title (Why?), I'm just going to add that iPadOS is the platform I am on.

Background:
I built a (somewhat large) hotel/resort in my world, and I was interested in adding a keycard system for the doors. Because of the way the structure is built (and there is no way I am going to remodel something this size), there is only room for three blocks under the door.
Horrible example below:

|xxxxxxxxxx|DoorIsHere|xxxxxxx|
|OpenBlock|OpenBlock|OpenBlock|

Is there a way I can create a system to unlock the door when tapped by the player (and only the player) with the key using these four open blocks? There are over 100 doors, and each would need its own key, plus, I would like a master key if that is possible. I would like to avoid the use of mods, but if that is the only way...

If the use of a button is needed, it can be placed on the bottom wall block, but I would rather no button be used. If possible, I would just like the player to tap the door, and the door would open if the player holds the correct key.

Another user posted a solution that incorporates the use of tags, so is there any way I can put a command block under (Or preferable under and to the left of) the door and have the door open if a player with the correct tag/key taps it? If “Tags” are not the best way to do this, that's fine!

Edit: I removed the fact that there is an open block directly to the right of the door because I would rather there not be a non-matching block on the wall next to every door. If a block is needed there (And there is no other way to do this), I guess I would be willing to do it. Thanks again for any suggestions.

Edit 2: Someone suggested having the command blocks elsewhere, and after some thought, I would be willing to do this. My thought on this is to have a room full of command blocks that would somehow ‘talk’ to the door and open it if the player with the key tapped it (or a button next to it). Would anyone know how to do this? Thanks!

Edit 3: Does anyone have anything that could work? At this point I'm willing to accept anything with the command block, even of it requires multiple blocks away from the door. I have unlimited (almost) space away from the door, so let me know what would work! (No, I don't want to create a 20 block system for each door :)

4
  • 1
    Would it be acceptable to place the command blocks elsewhere?
    – ginkgo
    Commented Aug 22, 2021 at 15:20
  • Yes, although than I would have to get the coordinates for every door, correct? Commented Aug 23, 2021 at 1:01
  • @Greenreader9 to be fair, you'd have to visit each door when setting up on-site anyways. However, the issue is how to open the door at that point.
    – Taco
    Commented Aug 23, 2021 at 17:57
  • I know I would have to visit the door, tear out the floor, get its coordinates, etc. As I said in the second edit, I would be willing to do this, and at this point, I just want a (working) keycard system :) Commented Aug 23, 2021 at 20:56

1 Answer 1

6

Note: This answer does NOT meet the requirements of the question, given that a door cannot be placed on a redstone comparator. However, I'm leaving it due to the amount of effort I put into it. The underlying concept may still be useful to future readers. I should really avoid answering in the evenings from now on. 😂


This can be accomplished with two commands:

  • The tag command can be used to serve as the "key".
  • The testfor command can be used to determine if a nearby player has the expected "key".

📝 Required Items

  • 1 Command Block
  • 1 Redstone Comparator
  • 1 Redstone Dust
  • 1 Block (any kind that allows placement of redstone dust)
  • 2 Buttons

🧰 Configuration

Since you have three spots under the door and one to the side, place 1 command block, 1 redstone comparator, 1 block that allows placement of redstone dust, and 1 sprinkle of redstone dust in the following configuration:

Screenshot of the aforementioned configuration.

The command block should be given the following command and configuration:

# Command (replace number in the tag with the number of the door)
testfor @p[tag=door_number,r=3]

# Configuration
Repeat
Unconditional
Needs Redstone
50 Ticks

Giving a delay in ticks with a repeating configuration allows the door to automatically close once the player leaves the immediate area. You'll also need to use a button to trigger the command block from both sides of the door (allowing players to open the door):

Screenshot of the button placement.

🔑 Keys

You still need to give players the keys to their rooms, which you can do with the tag command:

tag player_name_here add door_number
6
  • Since there are only three spaces under the door, I can't place the door on the response compactor can I? There is not space to put another block on top of the compactor for the door to stand on top of. Commented Aug 20, 2021 at 23:07
  • @Greenreader9 :facepalm:... you're absolutely correct. I'll leave the answer so it doesn't go to waste for future readers, but I'll add a note that it doesn't meet your needs.
    – Taco
    Commented Aug 20, 2021 at 23:19
  • Thanks :) Do you know if there is a way to bump this topic without getting flagged since it is probably on the bottom of a very long list by now? Commented Aug 20, 2021 at 23:49
  • 1
    @Greenreader9 I offered a bounty on it. It won’t guarantee an answer but should help visibility.
    – Taco
    Commented Aug 21, 2021 at 18:13
  • 1
    @Greenreader9 No worries! I'd like to see this answered too lol also, you'll get an association bonus of 100 rep once you accumulate more than 200 rep on any SE site.
    – Taco
    Commented Aug 21, 2021 at 21:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.