Class LivingBreatheEvent

java.lang.Object
net.neoforged.bus.api.Event

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

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

This event is not
invalid reference
ICancellableEvent
.

This event does not have a result.
invalid reference
HasResult

This event is fired on NeoForge.EVENT_BUS
  • Field Details Link icon

    • canBreathe Link icon

      private boolean canBreathe
    • consumeAirAmount Link icon

      private int consumeAirAmount
    • refillAirAmount Link icon

      private int refillAirAmount
  • Constructor Details Link icon

    • LivingBreatheEvent Link icon

      public LivingBreatheEvent(LivingEntity entity, boolean canBreathe, int consumeAirAmount, int refillAirAmount)
  • Method Details Link icon

    • canBreathe Link icon

      public boolean canBreathe()
      If the entity can breathe, their air value will be increased by getRefillAirAmount().
      If the entity cannot breathe, their air value will be reduced by getConsumeAirAmount().
      Returns:
      True if the entity can breathe
    • setCanBreathe Link icon

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

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

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

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

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