Jump to content

Recommended Posts

Posted

Is it possible to overwrite the standard packet handler from Minecraft? So I can alter the way the client handles stuff like health changes etc.?

Posted

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.

Posted

I'm creating a mod that is completely client side so modding the server side is not an option. I'm not altering the players health, I'm acting based on the current (nothing with the player itself).

Posted

Hi

 

Yes I think there is a way; use ASM + Reflection to edit the vanilla handler for the packet you're interested in.

 

Apart from that, I don't know of any way to intercept packets before vanilla gets hold of them for processing.

 

-TGG

Posted

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

 

Posted

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...

Posted

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?

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.