Remove Player Damage Animation

Discussion in 'Plugin Development' started by ChristianWP3579, Jul 24, 2017.

Thread Status:
Not open for further replies.
  1. Offline

    ChristianWP3579

    Hello. I am working on a plugin with a custom combat style. I can't get the damage animation to go away without canceling the EntityDamageEvent. I want the NoDamageTicks to be exact and I also don't want to have the player wait 3 seconds until the regeneration starts if their food level is full. All of my code is working well, I just don't know how to go about removing the damage animation to stop when the player is damaged.

    Here is a video showing the results of when I use the event canceling method on the first part, and no cancel on the second --->



    I want the results of the first part, with the immediate brief health regeneration that you see in the second part. for the first part, I simply canceled the event and applied the damage manually by using Player.setHealth(currentHealth-damagevalue) and added the NoDamageTicks at the max value, and in the second part I simply did not cancel it. I don't want that damage animation when he jolts after getting hurt and I also want that immediate small health regeneration that he gets when losing half a heart or more. Once again, my code is fine, I just don't know what I need to do to manually give that little health boost upon damage or at remove the jolt without canceling the event. I have been on google ALL NIGHT looking for a solution and could not find one, so I finally came to get help here. If anyone can assist me with figuring this out, it will be greatly appreciated!
     
  2. Offline

    Zombie_Striker

    @ChristianWP3579
    You will need to use ProtocolLib. Listen for the Animation Packet and check if the ID is equal to the player and if the animation type is 1 (take damage). If so, block the packet.
     
    ChristianWP3579 likes this.
  3. Offline

    ChristianWP3579

    Thank you, I will try that out.
     
Thread Status:
Not open for further replies.

Share This Page