This is my first time working with packets, so I've probably made a very obvious noob mistake somewhere... Basically whenever I make the client send a packet to the server, it fails.
This is my first time working with packets, so I've probably made a very obvious noob mistake somewhere... Basically whenever I make the client send a packet to the server, it fails.
4. PacketRequestFOO calls toBytes on the client, this is expected
5. PacketRequestFOO calls fromBytes on the client, not sure why this happens
7. PacketRequestFOO is sent to server
6. Nothing else happens
I suspect the side checks may be causing problems. Read this, it explains the concept of sides and how to make a proxy. A proxy allows you to easily run sided code, it's much better than your current system.
Rollback Post to RevisionRollBack
Please don't PM me asking for help, I will just redirect you to the appropriate forum, where there are others who are far more skilled than me.
I didn't even know there was such a thing as a logical side and physical side, thanks for the link.
I was reading up on sides and I found this:
It is important to understand that FML picks the proxy to instantiate based on the physical side. A single player world (logical server + logical client within a physical client) will still have a proxy of the type you specify in clientSide!
I was having issues where the client was sending the packet to itself on singleplayer (and creating an infinite loop), even when callinging Main.NETWORK.sendToServer, that's why I added the if(SIDE == CLIENT) check (I didn't know there was a logical and physical client at the time).
Perhaps I'm not thinking this through correctly, but I think this would still cause the client to send the packet to itself, instead of it's logical server. I don't really want that to occur.
I'll try your suggestion out first though and see if it works.
This is my first time working with packets, so I've probably made a very obvious noob mistake somewhere... Basically whenever I make the client send a packet to the server, it fails.
PacketRequestFoo.class (contains handler)
Main.class (only related methods shown)
FOO.class (only related methods shown)
Console Output
What appears to be happening is this:
1. User presses key, calls FOO.onKeyEvent
2. FOO.onKeyEvent calls FOO.doBar
3. FOO.doBar creates a new PacketRequestFOO
4. PacketRequestFOO calls toBytes on the client, this is expected
5. PacketRequestFOO calls fromBytes on the client, not sure why this happens
7. PacketRequestFOO is sent to server
6. Nothing else happens
My Github ด้้้้้็็็็็้้้้้็็็็็้้้้้็็็็็้้้้้็็็็็้้้้้็็็็็้้้้้็็็็็้้้้้็็็็็้้้้้дด็็็็็้้้้้็็็็้้้้้็็็็็้้้้้็็็็็้้้้้็็็็็้้้้้
I suspect the side checks may be causing problems. Read this, it explains the concept of sides and how to make a proxy. A proxy allows you to easily run sided code, it's much better than your current system.
Please don't PM me asking for help, I will just redirect you to the appropriate forum, where there are others who are far more skilled than me.
This is not the signature you are looking for.
Banners and such things
Yeah, I'd remove this:
You don't need it. The packet will only be sent and run on the server, so no need to check.
I didn't even know there was such a thing as a logical side and physical side, thanks for the link.
I was reading up on sides and I found this:
I was having issues where the client was sending the packet to itself on singleplayer (and creating an infinite loop), even when callinging Main.NETWORK.sendToServer, that's why I added the if(SIDE == CLIENT) check (I didn't know there was a logical and physical client at the time).
Perhaps I'm not thinking this through correctly, but I think this would still cause the client to send the packet to itself, instead of it's logical server. I don't really want that to occur.
I'll try your suggestion out first though and see if it works.
My Github ด้้้้้็็็็็้้้้้็็็็็้้้้้็็็็็้้้้้็็็็็้้้้้็็็็็้้้้้็็็็็้้้้้็็็็็้้้้้дด็็็็็้้้้้็็็็้้้้้็็็็็้้้้้็็็็็้้้้้็็็็็้้้้้