Class LivingBreatheEvent

java.lang.Object
net.minecraftforge.eventbus.api.Event

public class LivingBreatheEvent extends LivingEvent
LivingBreatheEvent is fired whenever a living entity ticks.

This event is fired via ForgeHooks.onLivingBreathe(LivingEntity, int, int).

This event is not Cancelable.

This event does not have a result. Event.HasResult
This event is fired on MinecraftForge.EVENT_BUS
  • Field Details

    • canBreathe

      private boolean canBreathe
    • canRefillAir

      private boolean canRefillAir
    • consumeAirAmount

      private int consumeAirAmount
    • refillAirAmount

      private int refillAirAmount
  • Constructor Details

    • LivingBreatheEvent

      @Internal public LivingBreatheEvent(LivingEntity entity, boolean canBreathe, int consumeAirAmount, int refillAirAmount, boolean canRefillAir)
  • Method Details

    • canBreathe

      public boolean canBreathe()
      If the entity can breathe and canRefillAir() returns true, their air value will be increased by getRefillAirAmount().
      If the entity can breathe and canRefillAir() returns false, their air value will stay the same.
      If the entity cannot breathe, their air value will be reduced by getConsumeAirAmount().
      Returns:
      True if the entity can breathe
    • setCanBreathe

      public void setCanBreathe(boolean canBreathe)
      Sets if the entity can breathe or not.
      Parameters:
      canBreathe - The new value.
    • canRefillAir

      public boolean canRefillAir()
      If the entity can breathe, canRefillAir() will be checked to see if their air value should be refilled.
      Returns:
      True if the entity can refill its air value
    • setCanRefillAir

      public void setCanRefillAir(boolean canRefillAir)
      Sets if the entity can refill its air value or not.
      Parameters:
      canRefillAir - The new value.
    • getConsumeAirAmount

      public int getConsumeAirAmount()
      Returns:
      The amount the entity's air supply will be reduced by if the entity cannot breathe.
    • setConsumeAirAmount

      public void setConsumeAirAmount(int consumeAirAmount)
      Sets the new consumed air amount.
      Parameters:
      consumeAirAmount - The new value.
      See Also:
    • getRefillAirAmount

      public int getRefillAirAmount()
      Returns:
      The amount the entity's air supply will be increased by if the entity can breathe.
    • setRefillAirAmount

      public void setRefillAirAmount(int refillAirAmount)
      Sets the new refilled air amount.
      Parameters:
      refillAirAmount - The new value.
      See Also: