Jump to content

Recommended Posts

Posted

So I know that I can send reply, but what if I want to send few replies?

 

Just wanna know if using PacketHandler.dispatcher.send... //to someone

inside onMessage() of some of my message handler (receiver) is safe and won't cause some receive-packet lags (in case of huge code in onMessage())?

 

Client ---(sends one packet to server)---> Server (reads) ---(inside onMessage() creates 5 different packets and sends them somewhere)---> Clients that should receive packets.

 

Asking because, well - return message inside onMessage exists for some reason - but is it just wrapper (you have sender there and all stuff) that will simply send back message just like normal PacketHandler.dispatcher.send... or there is something more in that?

 

To be even more clear - is there an actual difference in those codes:

@Override
	public IMessage onMessage(...cut...)
	{
		//data is a NBTTag. Inside PacketReplyMessage it's being unpdacked analysed and send back to client.
		return new PacketReplyMessage((NBT)data);
	}

and

@Override
	public IMessage onMessage(...cut...)
	{
		//Shitload of getting and comparing from some string arrays, putting up data and then sending it in (String)data.
		//In previous example everything above happens inside new reply packet instead of here in onMessage().
		PacketHandler.dispatcher.sendTo(new PacketReplyMessage((String)data), player);
		return null;
	}

1.7.10 is no longer supported by forge, you are on your own.

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.