Jump to content

Handling Vanilla packets


karolek471

Recommended Posts

Hi, I'm new to Forge but I'm pretty familiar with "raw-modding" or using APIs like Risugami's modLoader. I need to make a clientside mod. I've already done all the hard work with MCP but "raw mod" is not what I want as conflicts with other mods might and will appear so I'm looking for ways to do it using Forge API. I haven't found any solid documentation on that topic, that's why I'm asking. And to overtake some not-so-helpful answers: No, I cannot do this using a "custom packet". This is a clientside mod. I need to read the packet that the server sends to a player. The reception of this packet is not always accompanied by events like entity spawn. I haven't found any event in Forge that might do the job. If you're interested, in MCP I've done it by calling my method from specific packet's processPacket(IClientPlayNetHandler handler) method. I don't know how to do it in Forge.

Link to comment
Share on other sites

thanks for your reply and let me quickly tell you what I mean. So I'm interested in a SPlaySoundEffectPacket. I need to capture it and get information out of it. As I said, I haven't found any event associated with the occurence I'm trying to work with. This Sound effect is not played alongside with a spawn of some entity or other action that might have an event in Forge.

Link to comment
Share on other sites

I don't really want to talk about what I want to achieve. I just need to know is it possible, or how to handle vanilla packets. I've heard about changing the Netty's pipeline but I havent found any solid documentation and as I said, I'm a newbie in forge. Sorry for inconvenience.

Link to comment
Share on other sites

I don't see a reason for me to talk about it. I've told you everything. I just need to know how to "hook up" onto some kind of event or something to be able to view that packet when it is being received by client. That's all I want to know.

Link to comment
Share on other sites

I don't want anyone to write a code for me, I just need to know how to do my stuff. I'm asking about it here, because I couldnt find a good documentation. There's no other way for a beginner to get such info than just asking on a forum. This is the only way to achieve my goal. It's a server specific thing, that server just sends the sound packet and that's all. No entity spawning, no player status change. Just that sound and it's important. I don't see any other way of handling it.

Link to comment
Share on other sites

2 minutes ago, diesieben07 said:

Well, you haven't actually told us what you want to handle (well, it's a sound...), so how can you be so sure of this?

I've quickly located the sound packet in MCP, put a simple "Hello world" text print, joined the server and whenever I've heard that sound I've got a "Hello world" printing.  Then I was able to extract sound position for example. This is what I need, I just need to get the position of the sound. This position is sent from server to client using SPlaySoundEffectPacket. It's not tied to any entity. Just a sound playing out of a thin air.

Link to comment
Share on other sites

Actually I've got a MCP -reborn for 1.15.2. I'm not making jar mods. This is why I'm here to ask about Forge API.

2 minutes ago, diesieben07 said:

"I found one way to do it, so that must be the only way". Do you not realize how stupid this sounds?

Yes indeed, but I've looked through the events and didn't found any. The closest I've got is PlaySoundAtEntityEvent but from the name I assume it's tied to entity. Also it carries no position information, so it's no use for me.

Link to comment
Share on other sites

Okay I don't think you understand my point. Let me reiterate through everything so we think about the same thing.

You have a server sending a SPlaySoundPacket to the client. This packet contains info about position of a sound, volume, pitch.

Client's network manager captures that packet and calls it's readPacketData and processPacket method. I need to hook my code up to that "processPacket", that means I need my code to run whenever that method is called. Intuitively I'd subscribe to an event that is called on packet reception, check what packet it is, if it's that sound packet I do my stuff, otherwise I just return. That's what I want to do, and the end goal is not relevant here. I've described the entire process for you.

Link to comment
Share on other sites

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.