Interface DamageStep


public interface DamageStep
A step represent an operation made by the platform (vanilla and mods) or modifiers added by plugins. Steps are structured as trees where children modify the input or output of the parent step. A damage calculation is made of multiple trees of steps.
  • Method Details

    • type

      Gets the DamageStepType of this step.
      Returns:
      the step type
    • cause

      Cause cause()
      Gets the Cause of this step.
      Returns:
      The cause of this step
    • isSkipped

      boolean isSkipped()
      Gets whether this step is skipped. When skipped, only the step itself and its side effects are ignored, children are still applied. A modifier willing to ignore every previous children should revert the damage to damageBeforeChildren(), or call skip() on each child.
      Returns:
      Whether this step is skipped
    • setSkipped

      void setSkipped(boolean skipped)
      Sets whether this step is skipped.
      Throws:
      IllegalStateException - if called after the step has finished.
      See Also:
    • skip

      default void skip()
      Skips this step.
      Throws:
      IllegalStateException - if called after the step has finished.
      See Also:
    • trySetSkipped

      default void trySetSkipped(Set<DamageStep.Part> parts, boolean skipped)
      Sets whether parts of this step are skipped. This has no effect on steps already finished.
      See Also:
    • trySkip

      default void trySkip(Set<DamageStep.Part> parts)
      Skips parts of this step. This has no effect on steps already finished.
      See Also:
    • damageBeforeChildren

      OptionalDouble damageBeforeChildren()
      The damage just before the children of this step. Returns empty if the value is not known yet.
      Returns:
      The damage before the children of this step
    • damageBeforeSelf

      OptionalDouble damageBeforeSelf()
      The damage just before this step. Returns empty if the value is not known yet.
      Returns:
      The damage before this step
    • damageAfterSelf

      OptionalDouble damageAfterSelf()
      The damage just after this step. Returns empty if the value is not known yet.
      Returns:
      The damage after this step
    • damageAfterChildren

      OptionalDouble damageAfterChildren()
      The damage just after the children of this step. Returns empty if the value is not known yet.
      Returns:
      The damage after this step
    • history

      Gets the DamageStepHistory this step belongs to.
      Returns:
      The history containing this step.
    • parent

      Optional<DamageStep> parent()
      Gets the parent of this step. Returns empty if this step is the root of its tree.
      Returns:
      The parent of this step
    • root

      default DamageStep root()
      Gets the root of this step.
      Returns:
      The root of this step
    • childrenBefore

      List<DamageStep> childrenBefore()
      Gets an immutable list of all children steps that applies just before this step.
      Returns:
      The list of children steps
    • childrenAfter

      List<DamageStep> childrenAfter()
      Gets an immutable list of all children steps that applies just after this step.
      Returns:
      The list of children steps