Topic category: Help with Minecraft modding (Java Edition)
In the series Steven Universe there is a temple door where each gem has their own room. I want to make a door where you have to place a certain item and you get sent to a room and make whatever. Let's us an example, I want to have a place where I store my diamonds. So, I put a Diamond into the door, the door gives back the diamond AND teleports me to a new room where I can place a chest and put diamonds in it. Afterwards, I wish to go sort out my gold, so I put a piece of gold into the door and it takes me to a new room. I place a chest and decide to go back to my diamond room, so I put a diamond in the slot and I am transported back to the room with a chest and a diamond waiting inside.
Use procedures to do this.
How is the question not what to do :p
I don't think you can do this.
You can't make a door that automatically teleports you to some rooms (because the door can't know where the rooms are), but you can do this:
Make an item (maybe called Coordinates Chooser).
Add this procedure to it:
when item right-clicked on block:
If [(is air at x, y+1, z) and (is air at x, y+2,z)] and (NOT block at x, y, z = bedrock)
Do
Set the (chooserx) nbt variable of entity to x
Set the (choosery) nbt variable of entity to y+1
Set the (chooserz) nbt variable of entity to z
The procedure blocks names might be wrong.
Anyway, this procedure lets you save the coordinates of a point.
I will post another comment here describing the next step because I don't want the page to reload and lose everything I wrote
(this is the second part of the previous comment)
Now that you made that item, make the door.
Add this procedure to "when block right-clicked"
If (item in entity's main hand = coordinates chooser) and (NOT item in entity's off hand = air)
Do
Set the [make text with (item in entity's off hand) +" x"] nbt variable of block to (get the chooserx nbt variable of entity)
//copy this last procedure block to make it work with y and z coordinates too. The x in make text with item in entity's off hand + "x" is not a coordinate, just the letter x.
Set the [make text with (item in entity's off hand) + "was used"] nbt block to true
If NOT (item in entity main hand = coordinates chooser)
Do
If (get nbt variable of block (make text with... +was used) = true
Teleport entity to...
I will continue this comment later
(this is the third part of a comment)
In the last part, I was saying
if [get nbt variable of block (make text with item in entity's main hand* +was used)]=true
Do
Teleport entity to (make text with item in player's main hand + x) (make text... + y) (make text... +z)
*in the previous comment I forgot that this should be the main hand
Well I wanted to make like a gui where the player places the item to be teleported to a structure.
The procedure I told you works based on the items in main hand and off hand.
You can also make it as a gui. You'll just need to change the procedure a bit.