Entities Air Change Event? Stopping armour stands from drowning

Discussion in 'Plugin Development' started by Lightspeed, Dec 20, 2015.

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

    Lightspeed

    Is there an air change event or a way to stop the particles from drowning entities?
     
  2. Offline

    Zombie_Striker

    @Lightspeed
    I do not understand what you mean by this. Particle EFFECTS do not damage entities in any way.

    You can look at BlockBreakEvent
     
  3. Offline

    Lightspeed

    @Zombie_Striker Sorry I ment particles from drowning entities like armour stands.
    Is there an event when a entities air level changes?

    If none of this makes sense I basically need to stop oxegen depleation for any entity if possible.
    If none of that above isn't possible can I stop the drowning particles for any mob?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Dec 20, 2015
  4. Offline

    Zombie_Striker

    @Lightspeed
    This would be Entity.setRemainingAirTicks()
     
  5. Offline

    Lightspeed

    Can I have it in an event?
     
  6. Offline

    Mrs. bwfctower

    @Lightspeed If you just don't want them to take damage after their oxygen bar depletes you could use the EntityDamageEvent, check if the Entity is a Player, check that the DamageCause is SUFFOCATION, and then cancel it (and set the remaining air ticks if you so desire).

    If you want their oxygen bar to always be full, since there isn't any Event for it, you could have a runnable that sets the remaining air ticks of it.
     
  7. Offline

    Lightspeed

    @Mrs. bwfctower Do you know how many ticks before 1 bubble goes down for the oxygen?
    I can maybe create an event for that.
     
  8. Offline

    Zombie_Striker

    @Lightspeed
    You can create a task that runs every 5 ticks (0.25 seconds), check if the player's air left is less than the max air that the player can have, and if that is the case you can reset the air ticks.
     
Thread Status:
Not open for further replies.

Share This Page