Why are you using read/writeVarInt? Just use the regular buffer.writeInt(int) and buffer.readInt() methods. Did you change the AbstractMessage class at all?
Lol, I should have read the crash report more carefully:
at EnergyTools.network.packet.client.SyncTeleporterContents.read(SyncTeleporterContents.java:25)
// well, line 25:
if (player.openContainer.getSlot(0).getStack() != null)
Hm, wonder what could possibly be out of bounds there? Maybe the Container doesn't have any slots?! lol. You can't assume the current container is what you want it to be - it could be anything, or even nothing (although in the case of EntityPlayer#openContainer, it is actually always something).
Also, you are using proxies incorrectly:
// NEVER use @SideOnly in a proxy!
@SideOnly(Side.CLIENT)
// NEVER make a static method in your proxy (that is part of the initialization process, at least)
public static void preInit(){
// NO. STATIC. METHOD. CALLS. It is wrong.
ClientProxy.preInit();
The whole point of the proxy system is that the correct one (server or client) will be used depending on the current context. Using static methods completely breaks that functionality.
The proper way is to have the 'public void preInit()' method in BOTH your server and client proxy, and to put what you need done in the appropriate class; so if you have some things that need to be done on the client side, they would go in the client proxy's implementation of #preInit, but not in the server proxy's.
Then, in your main class, you just call 'proxy.preInit()' and magic happens.
Sorry about the confusion. But I didn't completely include all of the SyncTeleporterContents class. Line 25 refers to #read(PacketBuffer buffer). #process is never called, But the error is most likely me using the proxies incorrectly. I'll see what I can do. Thanks!
Edit: SUPER WEIRD. I changed some settings to copy what I have done in my other mods that use packets. (Didn't do that previously, because I wanted to improve upon my code)
Either way, crash doesn't happen, nor does anything fishy come up in the console, while I'm testing it on a real server. But if I'm debugging, the crash happens...
Everything updates when the player opens the container.
Updated the tutorial slightly by adding a Footnote section on how to do away with writing an IMessageHandler for every IMessage. That was another major gripe I had with the way the SimpleNetworkWrapper system expects modders to write packets, and I've done away with it
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumWhy are you using read/writeVarInt? Just use the regular buffer.writeInt(int) and buffer.readInt() methods. Did you change the AbstractMessage class at all?
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumHave updated the previous message to include a few more things, including the abstract message.
I complicate easy problems, come begging for help, and leave with a simple solution.

-
View User Profile
-
View Posts
-
Send Message
Curse PremiumAlso, you are using proxies incorrectly:
The whole point of the proxy system is that the correct one (server or client) will be used depending on the current context. Using static methods completely breaks that functionality.
The proper way is to have the 'public void preInit()' method in BOTH your server and client proxy, and to put what you need done in the appropriate class; so if you have some things that need to be done on the client side, they would go in the client proxy's implementation of #preInit, but not in the server proxy's.
Then, in your main class, you just call 'proxy.preInit()' and magic happens.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumSorry about the confusion. But I didn't completely include all of the SyncTeleporterContents class. Line 25 refers to #read(PacketBuffer buffer). #process is never called, But the error is most likely me using the proxies incorrectly. I'll see what I can do. Thanks!
Edit: SUPER WEIRD. I changed some settings to copy what I have done in my other mods that use packets. (Didn't do that previously, because I wanted to improve upon my code)
Either way, crash doesn't happen, nor does anything fishy come up in the console, while I'm testing it on a real server. But if I'm debugging, the crash happens...
Everything updates when the player opens the container.
I complicate easy problems, come begging for help, and leave with a simple solution.

-
View User Profile
-
View Posts
-
Send Message
Curse PremiumUpdated the tutorial slightly by adding a Footnote section on how to do away with writing an IMessageHandler for every IMessage. That was another major gripe I had with the way the SimpleNetworkWrapper system expects modders to write packets, and I've done away with it