Jump to content

using a gui to change blocks


Recommended Posts

i'm making a block that has a gui with buttons and when i press 1 button i want it to check a few blocks and change them.

now i know how to write the code to check the blocks, and how to change them.

the problem i have is that i only know how to do that from inside another block, not from inside a gui, since in the gui i can't find how to ask for the coordinates of the block that has the gui.

so either i need a way for my gui to call a method inside the block, or a way to acces the gui block his coordinates, including what world it is in


and just for the record, i have already made a button within the gui, and i know what gui method is called when the button is pressed, so that's no problem

Link to comment
Share on other sites

Do you use a GUI handler to return the instance of the GUI?

If yes, I think your GUI is returned in the method "getClientGuiElement", so you could just add in the constructor of your GUI, three int parameters that represents the x, y and z coordinates, and when you have to instantiate your GUI you can simply pass the coords to it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.