3

I'm making a map (in Minecraft 1.19.2) where players open doors on a square map made out of rooms. Most rooms have 4 doors, which the player should be able to open from both sides.
I wanted to make command blocks for every button which would spawn an armor stand in the door, which I could use than as an anchor to activate some other command blocks to remove the door, easily slicing the needed command blocks in half. But that would still be a LOT of command blocks, like 600 command blocks just for the door alone.

Is there a way to check for pressed buttons in an area, spawn the armour stand behind the button, and activate the command block?

If not every step of this is possible, I want to use whatever I can to reduce the amount of command blocks I place.

2
  • 1
    So to clarify, there are going to be so many buttons and so many doors that it would be impractical to write a line for every one by hand? I'm also having trouble visualizing what you want to do with the armour stands. So you want the button to spawn an armour stand, and the command blocks detect that and open the door? Also what exactly are these doors, are they iron doors, wood doors, or blocks that look like doors?
    – One 2 Many
    Commented Aug 29, 2022 at 18:08
  • Sorry if I didn't explain it enough. So to provide a visualisation. There's a 9x9 grid of square rooms most of them have 4 doors (out of blocks) , due to them being in the center. Players spawn in the corners of the grid. By getting points buttons are gonna spawn which can be pressed to open said doors. From their side of course. I need a way to check if the button has been pressed without any command block shown (the doors are 1 block wide) I had a plan to spawn an armor stand tracker behind the button, and removing the blocks (opening doors) based on its position which would save me time. Commented Aug 29, 2022 at 18:50

2 Answers 2

1

I want to use whatever I can to reduce the amount of command blocks I place.

Do you already know how to use or have you considered using a function? That way you won't have to build 600 command blocks, but just write 1 file (function) which has 600 lines.

FYI, command blocks don't work unless they're rendered or they're in a spawn chunk.

1
  • 1
    Although I didn't think of using a data pack. I would prefer to keep it in just command blocks if possible. Also I would still have to write 600 lines of text, with coords in all of them which makes it a loop with the same problem, it would maybe save like 5 minutes so yeah. Commented Aug 29, 2022 at 13:21
1

You can track the state of a button using the command /execute.

I don't know what calculations you were using for getting that amount of command blocks, but all I know is that you can run a command when a button is pressed remotely by using /execute if block (x,y,z) minecraft:stone_button run (command) on a repeating command block.

If your only way to get this working is by building 600 command blocks, your best bet is to use functions, as the other answer mentioned. Functions are easy to use and make and don't require a client user (your friends) to download any files (when trying to connect to the server, as what happens with mods).

Also, if you use the command block method and if you need to run another command but run is already being used, you can add a comparator next to the command block that runs the /execute ... run ... command.

3
  • My problem isn't that I need 600 command blocks to do that. I need to open doors (which are full blocks btw) using fill. The problem with that is the rooms are made out of 4 doors and there are 81 rooms, that's about 290 doors (remember, corner and side rooms. Those doors must be able to be opened from both sides, if the player ends up on the other one first. Which makes me have to check for around 600 buttons, then I have to fill to remove the doors, making it 1200 command blocks. Sorry if my initial explanation wasn't enough. Commented Aug 29, 2022 at 14:16
  • Or with run command it would still be 600 command blocks. The problem here is there's so many buttons to check, but I don't know how I can do it without tons of command blocks for each button. Commented Aug 29, 2022 at 14:20
  • I don't know what to tell you except good luck. The way you want it to happen is impossible. Command blocks are limited to one instruction per block, so if you want to get that working, I guess that you could try to code a Spigot or Bukkit plugin for your server. Commented Aug 29, 2022 at 16:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .