Jump to content

Intercepting Packets sent from the server to the client


ipsq

Recommended Posts

A new topic wasn't needed, but what are you trying to do?

You originally wanted to know whether onLivingHurt event would work on Multiplayer, it will if you use it correctly, what do you want to do?

If you're only altering player's health amount, you can do it easily by changing player's health server-side, as Minecraft uses DataWatcher for updating entities' health to client, which is not the same as the ordinary way using packets.

Link to comment
Share on other sites

Could you give an example of that? I'm not experienced with the reflection api..

Unfortunately, I'm not experienced with it either, never had to use it :)

 

This tutorial will probably help

http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571568-tutorial-1-6-2-changing-vanilla-without-editing

 

It's for 1.6.2, I imagine the concepts are the same but you may need to do some more research to adapt it to 1.7.  And to learn some bytecode, which will either be really interesting or a major headache depending on your reaction to something like this:

 

0:   iconst_2
1:   istore_1
2:   iload_1
3:   sipush  1000
6:   if_icmpge       44
9:   iconst_2
10:  istore_2
11:  iload_2
12:  iload_1
13:  if_icmpge       31

 

I used to code in assembly so it looks like fun to me, but you might not agree :)

 

-TGG

 

Link to comment
Share on other sites

Don't intercept packets. Why do you think you need to?

Also: Client-only mods still need to worry about servers. SP uses a Server as well.

 

He wants to get notified of health changes client-side. I don't know if there is a way to get notified from the DataWatcher without coremods, I've never used it. I'm sure things other than health would need some vanilla packet handling which I'm not aware of whether it is possible or not.

And the fact that SP uses a server doesn't make "logically" client-only mods in need to interact with it, it is client-side only...

Link to comment
Share on other sites

since it's client only, can't he just have some sort of "old hp" variable that updates all the time, and when the update happens just do a check of

"is new hp != old hp ? setHealthWithMessage(hp,"Health Changed") : setHealth(hp);"

 

or would a simple alteration of one variable clog up the client's processing?

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.