Class ActiveEntityEffect

java.lang.Object
com.hypixel.hytale.server.core.entity.effect.ActiveEntityEffect
All Implemented Interfaces:
Damage.Source

public class ActiveEntityEffect extends Object implements Damage.Source
Represents a single active entity effect on an entity effect controller.
  • Field Details

  • Constructor Details

    • ActiveEntityEffect

      public ActiveEntityEffect()
      Empty Constructor for a ActiveEntityEffect instance.

      Used by the codec to instantiate ActiveEntityEffect instances.

    • ActiveEntityEffect

      public ActiveEntityEffect(@Nonnull String entityEffectId, int entityEffectIndex, float initialDuration, float remainingDuration, boolean infinite, boolean debuff, @Nullable String statusEffectIcon, float sinceLastDamage, boolean hasBeenDamaged, @Nonnull DamageCalculatorSystems.Sequence sequentialHits, boolean invulnerable)
      Default Constructor for a ActiveEntityEffect instance.
      Parameters:
      entityEffectId - The asset ID of the affiliated entity effect asset.
      entityEffectIndex - The asset index of the affiliated entity effect asset.
      initialDuration - The initial duration of the entity effect.
      remainingDuration - The remaining duration of the entity effect.
      infinite - Whether this entity effect is infinite.
      debuff - Whether this entity effect is a debuff.
      statusEffectIcon - The status effect icon to display for this entity effect.
      sinceLastDamage - The time since the player was last damaged.
      hasBeenDamaged - Whether the entity has been damaged by this active entity effect.
      sequentialHits - The sequential hits of this entity effect.
      invulnerable - Whether the entity is invulnerable while active.
    • ActiveEntityEffect

      public ActiveEntityEffect(@Nonnull String entityEffectId, int entityEffectIndex, float duration, boolean debuff, @Nullable String statusEffectIcon, boolean invulnerable)
      Constructor for a ActiveEntityEffect instance.
      Parameters:
      entityEffectId - The asset ID of the affiliated entity effect asset.
      entityEffectIndex - The asset index of the affiliated entity effect asset.
      duration - The duration of the entity effect.
      debuff - Whether this entity effect is a debuff.
      statusEffectIcon - The status effect icon to display for this entity effect.
      invulnerable - Whether the entity is invulnerable while active.
    • ActiveEntityEffect

      public ActiveEntityEffect(@Nonnull String entityEffectId, int entityEffectIndex, boolean infinite, boolean invulnerable)
      Constructor for a ActiveEntityEffect instance, with a set default duration.
      Parameters:
      entityEffectId - The asset ID of the affiliated entity effect asset.
      entityEffectIndex - The asset index of the affiliated entity effect asset.
      infinite - Whether this entity effect is infinite.
      invulnerable - Whether the entity is invulnerable while active.
  • Method Details

    • tick

      public void tick(@Nonnull CommandBuffer<EntityStore> commandBuffer, @Nonnull Ref<EntityStore> ref, @Nonnull EntityEffect entityEffect, @Nonnull EntityStatMap entityStatMapComponent, float dt)
      Called to tick this specific active entity effect.
      Parameters:
      commandBuffer - The command buffer for store access.
      ref - The entity store ref of the affiliated living entity.
      entityEffect - The affiliated entity effect asset.
      entityStatMapComponent - The EntityStatMap component of the affiliated living entity.
      dt - The current delta time of this frame.
    • getDamageMultiplier

      public float getDamageMultiplier()
    • setDamageMultiplier

      public void setDamageMultiplier(float damageMultiplier)
    • getOwner

      @Nullable public Ref<EntityStore> getOwner()
      Returns:
      the entity that owns this effect (the one that applied it), or null when unknown.
    • setOwner

      public void setOwner(@Nullable Ref<EntityStore> owner)
    • getEntityEffectIndex

      public int getEntityEffectIndex()
      Returns:
      the index of the entity effect asset.
    • getInitialDuration

      public float getInitialDuration()
      Returns:
      the initial duration, in seconds, of this active entity effect.
    • getRemainingDuration

      public float getRemainingDuration()
      Returns:
      the remaining duration, in seconds, of this active entity effect.
    • isInfinite

      public boolean isInfinite()
      Returns:
      true if this effect is infinite, false otherwise.
    • isDebuff

      public boolean isDebuff()
      Returns:
      true if this effect is a debuff, false otherwise.
    • isInvulnerable

      public boolean isInvulnerable()
      Returns:
      true if this effect is invulnerable, false otherwise.
    • getDeathMessage

      @Nonnull public Message getDeathMessage(@Nonnull Damage info, @Nonnull Ref<EntityStore> targetRef, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Description copied from interface: Damage.Source
      Generates a death message from this source and any information provided in info.
      Specified by:
      getDeathMessage in interface Damage.Source
      Parameters:
      info - The damage info to inspect
      targetRef - The entity reference of the entity that has been killed.
      componentAccessor - The ComponentAccessor<EntityStore> for component access.
      Returns:
      The generated death message
    • getSourceType

      @Nonnull public DamageSourceType getSourceType()
      Specified by:
      getSourceType in interface Damage.Source
      Returns:
      the DamageSourceType of this source.
    • toString

      @Nonnull public String toString()
      Overrides:
      toString in class Object