Class BreathingCheckEvent

java.lang.Object
com.hypixel.hytale.component.system.EcsEvent
com.hypixel.hytale.server.core.event.events.ecs.BreathingCheckEvent

public class BreathingCheckEvent extends EcsEvent
An event that is fired when the block material or fluid at an entity's breathing height changes.

The canBreathe() value is initialized with the vanilla breathing result. Event handlers can override it via setCanBreathe(boolean) to customize breathing behavior for specific entity types (e.g. NPCs that can breathe underwater).

  • Constructor Details

    • BreathingCheckEvent

      public BreathingCheckEvent(@Nonnull BlockMaterial breathingMaterial, int fluidId, boolean canBreathe)
      Default Constructor for a BreathingCheckEvent instance.
      Parameters:
      breathingMaterial - The block material at the entity's breathing height.
      fluidId - The fluid ID at the entity's breathing height.
      canBreathe - The default breathing result from vanilla logic.
  • Method Details

    • getBreathingMaterial

      @Nonnull public BlockMaterial getBreathingMaterial()
      Returns:
      the block material at the entity's breathing height.
    • getFluidId

      public int getFluidId()
      Returns:
      the fluid ID at the entity's breathing height.
    • canBreathe

      public boolean canBreathe()
      Returns:
      true if the entity can breathe, false otherwise.
    • setCanBreathe

      public void setCanBreathe(boolean canBreathe)
      Sets whether the entity can breathe.
      Parameters:
      canBreathe - Whether the entity can breathe.