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

How would I go about interfacing between a button clicked between my GUI and Tile entity? I know it has to do with Packets, but I'm not sure how to send/receive those packets on either end.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

  • Author
3 minutes ago, Draco18s said:

This shows me how to create the bare bones implementation, but there isn't anything pertaining to how to use it in the slightest, or if there is, it doesn't make any sense to me, at least to a tileEntity, because I can see how to send something to a server, but I can't tell how to read it or even receive it.

Edited by BURN447

When the button is clicked -> send a packet to the server with the relevant information (TE's pos, what button was clicked).

Server gets the packet, reads the data, gets the TileEntity from the position encoded in the packet, and does things (if valid to perform).

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

  • Author

How would I interpret what is happening in the tileEntity itself? I'm assuming it has to do with the onDataPacket function

You want to know what data the TE has?

Yes, you override those three methods. Yes there are three.

getDataPacket: sending

getUpdateTag: sending

onDataPacket: recieving

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

  • Author
Just now, Draco18s said:

You want to know what data the TE has?

Yes, you override those three methods. Yes there are three.

getDataPacket: sending

getUpdateTag: sending

onDataPacket: recieving

I'm actually trying to send a packet from the client that a button was clicked, and if so, start a process on the server, which would then set the variable on both ends back to false until the button is clicked again. But this is starting to make sense, and I think I might be able to figure it out. I'm thinking that I'd use pkt.readInt and then send one back setting the variable back to false.

I'm not sure if this is the best implementation, but I did it like so:

 

In the GUI class, when the button is pressed (checked with actionPerformed) you use your packet handler to send to server a custom message with the information you need. When the message is sent to the server, you can set the variable on the server side with a handler. Then inside the server handler you can send a packet to players.

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.