Hey JGO, lastnight I was goofing around with networking and I wanted to write a project that can send custom packets accross a network, I didn’t get very far lol.
Here’s what I tried doing:
public class StandardPacket implements Serializable {
public StandardPacket() {
}
}
I was trying to accomplish sending a CustomPacket that extends the serializable StandardPacket but it wouldn’t go through.
When the client/server got the packet it wouldn’t allow my casting:
org.gnetwork.client.packets.TestPacket cannot be cast to org.gnetwork.server.packets.TestPacket.
Questions:
- How did kryonet go about sending custom packets?
- How would I go about having a class extend my StandardPacket and be able to send it over the network and have it be received as a CustomPacket vs StandardPacket?
- Am I following the right path for doing this?
Example of my CustomPacket class:
public class CustomPacket extends StandardPacket {
private String someCustomData;
public CustomPacket() {
}
/* Getters & Setters for data */
}
Thanks for any help/feedback JGO, if more information is needed please ask.