Jump to content

[1.7.2] Problem with GUI buttons not controlling correct block


Recommended Posts



I've created a custom rendered gate that open and closes with a gui button but it seems to open and close other gates in your view.


I have looked at my code and cant see where im going wrong.


I have all my code available on github https://github.com/paranormalryno/Test-Mod





i think that you will need packets to sync your client(gui) with server....

Here could be your advertisement!

Link to comment
Share on other sites

  • 3 weeks later...

If you have a Container (which you do) you don't need custom packets. Just call Minecraft#playerController.sendEnchantPacket(windowID, buttonID) when the button is pressed. That will trigger a call to the enchantItem method on your Container on the server, with the same ID.


I've added a enchantItem method in my container which now sends the command to open or close the gate and added the sendEnchantPacket under the actionPreformed sending the windowID and buttonID but im getting a NullPointerException. I not sure if I'm doing it correct but after looking at the enchantment GUI and Container class that's what I came up with.

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.