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.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptioncause()
Gets theCause
of this step.Gets an immutable list of all children steps that applies just after this step.Gets an immutable list of all children steps that applies just before this step.The damage just after the children of this step.The damage just after this step.The damage just before the children of this step.The damage just before this step.history()
Gets theDamageStepHistory
this step belongs to.boolean
Gets whether this step is skipped.parent()
Gets the parent of this step.default DamageStep
root()
Gets the root of this step.void
setSkipped
(boolean skipped) Sets whether this step is skipped.default void
skip()
Skips this step.default void
trySetSkipped
(Set<DamageStep.Part> parts, boolean skipped) Sets whether parts of this step are skipped.default void
trySkip
(Set<DamageStep.Part> parts) Skips parts of this step.type()
Gets theDamageStepType
of this step.
-
Method Details
-
type
DamageStepType type()Gets theDamageStepType
of this step.- Returns:
- the step type
-
cause
Cause cause()Gets theCause
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 todamageBeforeChildren()
, or callskip()
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
Sets whether parts of this step are skipped. This has no effect on steps already finished.- See Also:
-
trySkip
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
DamageStepHistory history()Gets theDamageStepHistory
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
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
-