Jump to content

Recommended Posts

Posted

I have build my network communication on one channel sending different classes of Packets, derived from the Packet250CustomPayload class. In the Packet handler I check for the class of the just received packet, to decide which class should do the handling:

 

 

  Reveal hidden contents

 

 

this works well on the SSP side. But, as I had to learn just now, crashes when I try to run my mod with an SMP server.

 

The problem is, the Packet class does not know about my new Packet classes, so they produce a NullPointerException.

 

  Reveal hidden contents

 

 

The vanilla packets themselve are added statically, hard coded in the Packet class to the list of known Packets. Of course the Packet lists are not protected, but private...

 

from the net.minecraft.src.Packet class:

 

  Reveal hidden contents

 

 

now there is a static method in the Packet class adding new Packets to the list. In fact it is used in the static part of the Packet class to add the vanilla Packets to the above mentioned lists.

 

 

  Reveal hidden contents

 

 

and this time the method has no explicitly declared access modifier and thus it is effectively private (ARGH!!! sloppy programming, but I presume they would have made it private anyway ...).

 

Thus even so, my Packet class is ultimately derived from the Packet class, I can not access the Packet list nor the add method, thus can not use my Packets in SMP (and I wonder how it is working in SSP in the first place).

 

So, my suggestion is, could you have the Forge packet alter the Packet class so that

 

a) the addIdClassMapping will receive the protected access modifier

 

and

 

b) there is a method to get the next free packetId to be used for the next Packet registration?

running minecraft on Mac OS X - Sierra --- creating code since 1986 ... --- मेरा दिल भारतवासी है!

width=289 height=100http://www.arno-saxena.de/pictures/chococraft/banner_signature.png[/img]

Posted

Simple, don't add a new packet type, there is no need to and you fuck up compatibility if you do.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

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.