Skip to content

Commit d6f9fbf

Browse files
committed
Add supplier overloads to DamageCalculationEvent
1 parent 37068ec commit d6f9fbf

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/main/java/org/spongepowered/api/event/entity/DamageCalculationEvent.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import org.spongepowered.eventgen.annotations.ImplementedBy;
3939

4040
import java.util.List;
41+
import java.util.function.Supplier;
4142

4243
/**
4344
* The base event for when some damage is calculated,
@@ -82,6 +83,16 @@ public interface DamageCalculationEvent extends Event, Cancellable {
8283
@ImplementedBy(AbstractDamageCalculationEventPre.class)
8384
interface Pre extends DamageCalculationEvent {
8485

86+
/**
87+
* Gets a mutable list of all modifiers that applies just before the step.
88+
*
89+
* @param type The step type
90+
* @return The list of modifiers
91+
*/
92+
default List<DamageModifier> modifiersBefore(Supplier<DamageStepType> type) {
93+
return this.modifiersBefore(type.get());
94+
}
95+
8596
/**
8697
* Gets a mutable list of all modifiers that applies just before the step.
8798
*
@@ -90,6 +101,16 @@ interface Pre extends DamageCalculationEvent {
90101
*/
91102
List<DamageModifier> modifiersBefore(DamageStepType type);
92103

104+
/**
105+
* Gets a mutable list of all modifiers that applies just after the step.
106+
*
107+
* @param type The step type
108+
* @return The list of modifiers
109+
*/
110+
default List<DamageModifier> modifiersAfter(Supplier<DamageStepType> type) {
111+
return this.modifiersAfter(type.get());
112+
}
113+
93114
/**
94115
* Gets a mutable list of all modifiers that applies just after the step.
95116
*

0 commit comments

Comments
 (0)