Posted March 7, 20187 yr I need to know when a packet is received. Forge has a handler for when a chat message is received, I want something exactly the same except for handling different packets(specifically the velocity updates and animations update). My end goal is to in some way, accurately know the distance an entity was attacked from and make a prediction as to which entity attacked them; it seems the only way to do this is to calculate the entities distance to all nearby mobs when it's velocity is updated from being attacked. I have been attempting to use hurtDelay and several other fields to avoid this problem here, but it seems I just cannot accurate values(or maybe I do and the idea that I could possibly have a "perfect" prediction by measuring distances the second the velocity packet is received bugs me). I know a few ways I could do this(ASM or replace the instance of NetHandler when it is instantiated), but I do not know what the best way is. I would like for whatever method I choose not to conflict with other mods. I am forced to use 1.8.9, sorry for being outdated. Edited March 7, 20187 yr by Ben0017 Added more information
March 7, 20187 yr What exactly are you trying to do? The server already knows who attacked you so why not just have the server send the info directly? Or is it because you want this to be a client-side-only mod? What specifically are you trying to do? Are you doing this for projectiles like arrows? In that case I think you could simply detect when arrow are created and tag them with information about the entity at that location that probably is shooting it. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
March 7, 20187 yr Author It is going to be a client side mod only. The only information the server sends when an entity is attacked is the animation/velocity packets, both of which do not fire a forge event. I need to know when each packet is received, and the target entity. In the NetHandlerPlayClient class, there are methods, such as handleAnimation(), which do not fire any forge event. I need to somehow make these methods fire an event, similar to how the handleChat() method fires a forge event. I would like to know the correct way to implement this into a forge mod, I already know I could insert a line of code with ASM or replace the NetHandlerPlayClient variable when it is initialized with an instance of a nearly identical class; however, there probably is a better way to fix my problem since ASM should be a last resort. Edited March 7, 20187 yr by Ben0017
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.