Class BreathingComponent

java.lang.Object
com.hypixel.hytale.server.core.modules.entity.component.BreathingComponent
All Implemented Interfaces:
Component<EntityStore>, Cloneable

public class BreathingComponent extends Object implements Component<EntityStore>
A component that tracks the breathing state of an entity, including the block material and fluid at the entity's breathing height.

Utilised by the damage systems to apply damage if an entity is suffocating.

  • Constructor Details

    • BreathingComponent

      public BreathingComponent()
  • Method Details

    • getComponentType

      public static ComponentType<EntityStore, BreathingComponent> getComponentType()
    • getLastBreathingMaterial

      @Nullable public BlockMaterial getLastBreathingMaterial()
      Gets the last block material recorded at the entity's breathing height.
      Returns:
      The last block material at the entity's breathing height, or null if not yet recorded.
    • setLastBreathingMaterial

      public void setLastBreathingMaterial(@Nonnull BlockMaterial lastBreathingMaterial)
      Sets the last block material recorded at the entity's breathing height.
      Parameters:
      lastBreathingMaterial - The block material at the entity's breathing height.
    • getLastFluidId

      public int getLastFluidId()
      Returns:
      the last fluid ID at the entity's breathing height.
    • setLastFluidId

      public void setLastFluidId(int lastFluidId)
      Sets the last fluid ID recorded at the entity's breathing height.
      Parameters:
      lastFluidId - The fluid ID at the entity's breathing height.
    • isSuffocating

      public boolean isSuffocating()
      Returns:
      true if the entity is suffocating, false otherwise.
    • setSuffocating

      public void setSuffocating(boolean suffocating)
      Sets whether the entity is currently suffocating.
      Parameters:
      suffocating - Whether the entity is suffocating.
    • clone

      @Nonnull public Component<EntityStore> clone()
      Specified by:
      clone in interface Component<EntityStore>
      Returns:
      a clone instance of the original component instance.