Jump to content

Recommended Posts

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.

Posted

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.

Posted (edited)
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
Posted

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.

Posted

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.

Posted
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.

Posted

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...

×   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.

Announcements



×
×
  • Create New...

Important Information

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