Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

All I am wanting to do is properly send a packet to the server and handle it properly when a user clicks a button in the Inventory. I have not messed with these before and looking at source code I have the packets setup and ready to go. I just don't know how to pass the button Id properly. Like wont I need the cordinates for where the TileEntity is? So in the gui when I send the packet I will need to send the TileEntity with it? I seen some people do the

modID.network.sendToServer()

and the

modID.network.getPacketFrom()

I don't know which one to use. My issue is that I got to see it finished to understand it. If I had a good source code that shows a process like that I would look at that. I tired looking at Mekanism, but seems like its all over the place. I'm pretty sure once I figure this one out afterwards it wont be too hard to understand. I got the Message class and all the needed classes for to send the packet I just don't know how to link it.

  • Author

ok so I would send the packet

ModID.network.sendToServer(new MessageGuiButton(button.id));

and then in the Handler class have the onMessage() take in the Id and get the player, container, and finally the TileEntity. And since we are getting the TileEntity that way it already knows what one we are talking about. Is that correct?

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.

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.