Entity damage event no damage ticks

Discussion in 'Plugin Development' started by donsavage, May 28, 2014.

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

    donsavage

    I'v been playing around with the entity damage event, and I'm trying to tell when an entity takes damage. I have tried something along the lines "if !event.isCanceled() && entity.getNoDamageTicks()>0" but this doesn't seem to work if the entity is being spammed with attacks such as punching. It seems that some damage causes can take place at the 10 tick mark, and others, such as contact with fire or cacti, happen even more frequently. Is there a method I can use, or math formula I can use to make sure I know exactly when an entity is taking damage? I read the post here: http://forums.bukkit.org/threads/whats-up-with-setnodamageticks.141901/#post-1638021 which shines some light on the subject, but I feel like its not complete...
     
  2. Offline

    acosta9898

    donsavage Well, when the EntityDamageEvent is called, that's exactly when the entity is being damaged...

    What exactly are you trying to do when the Entity is damaged?

    P.S. idk if this is helpful to what you are trying to accomplish, but there is an Enum called DamageCause which can be used to find what is damaging the entity..
     
  3. Offline

    donsavage

    acosta9898

    You don't understand. EntityDamageEvent is called whenever an entity is in contact with something that could damage it, not when its being damaged. By that I mean, if I attack it, it will be called, if I attack it twice very quickly, It will be damaged once, but called twice because of the noDamageTicks() function

    If there's still confusion about what I mean please let me know.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 1, 2016
  4. Offline

    acosta9898

    Hmm I think I understand now donsavage
    but why exactly do you need to find exactly when the entity is damaged?
     
Thread Status:
Not open for further replies.

Share This Page