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 Link icon

    • type Link icon

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

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

      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 Link icon

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

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

      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 Link icon

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

      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 Link icon

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

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

      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 Link icon

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

      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 Link icon

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

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

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