Class Condition

java.lang.Object
com.hypixel.hytale.server.core.modules.entity.condition.Condition
Direct Known Subclasses:
AliveCondition, ChargingCondition, CheckPlayerGameModeCondition, EntityStatBoundCondition, EnvironmentCondition, GlidingCondition, HasEffectCondition, InFluidCondition, IsPlayerCondition, LogicCondition, NoDamageTakenCondition, OutOfCombatCondition, RegenHealthCondition, SprintingCondition, SuffocatingCondition, WieldingCondition

public abstract class Condition extends Object
A class that represents a condition for entity stats.
  • Field Details

  • Constructor Details

    • Condition

      public Condition(boolean inverse)
      Constructor for a Condition instance.
      Parameters:
      inverse - Whether to invert the condition.
  • Method Details

    • eval

      public boolean eval(@Nonnull ComponentAccessor<EntityStore> componentAccessor, @Nonnull Ref<EntityStore> ref, @Nonnull Instant currentTime)
      Called to evaluate the condition for the given entity.
      Parameters:
      componentAccessor - The ComponentAccessor<EntityStore> for store access.
      ref - The entity reference of the entity.
      currentTime - The current world time.
      Returns:
      true if the condition is met, false otherwise.
    • eval0

      public abstract boolean eval0(@Nonnull ComponentAccessor<EntityStore> componentAccessor, @Nonnull Ref<EntityStore> ref, @Nonnull Instant currentTime)
      The internal evaluation method for the condition.
      Parameters:
      componentAccessor - The ComponentAccessor<EntityStore> for store access.
      ref - The entity reference of the entity.
      currentTime - The current world time.
      Returns:
      true if the condition is met, false otherwise.
    • allConditionsMet

      public static boolean allConditionsMet(@Nonnull ComponentAccessor<EntityStore> componentAccessor, @Nonnull Ref<EntityStore> ref, @Nonnull Instant currentTime, @Nonnull EntityStatType.Regenerating regenerating)
      Determines whether all conditions are met.
      Parameters:
      componentAccessor - The ComponentAccessor<EntityStore> for store access.
      ref - The entity reference of the entity.
      currentTime - The current world time.
      regenerating - The EntityStatType.Regenerating instance containing the conditions.
      Returns:
      true if all conditions are met, false otherwise.
    • allConditionsMet

      public static boolean allConditionsMet(@Nonnull ComponentAccessor<EntityStore> componentAccessor, @Nonnull Ref<EntityStore> ref, @Nonnull Instant currentTime, @Nonnull Condition[] conditions)
      Determines whether all conditions are met.
      Parameters:
      componentAccessor - The ComponentAccessor<EntityStore> for store access.
      ref - The entity reference of the entity.
      currentTime - The current world time.
      conditions - The array of Condition instances to evaluate.
      Returns:
      true if all conditions are met, false otherwise.
    • toString

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