Interface DamageSource.Builder
- Enclosing interface:
DamageSource
public static interface DamageSource.Builder
Utility class to make building a
DamageSource easier. Only a
DamageType is required.- Since:
- 1.20.4
-
Method Summary
Modifier and TypeMethodDescription@NotNull DamageSourcebuild()Create a newDamageSourceinstance using the supplied parameters.@NotNull DamageSource.BuilderwithCausingEntity(@NotNull Entity entity) Set theEntitythat caused the damage.@NotNull DamageSource.BuilderwithDamageContext(@NotNull Consumer<net.kyori.adventure.pointer.Pointers.Builder> consumer) Configures a builder for thePointersused for plugin-provided damage context.@NotNull DamageSource.BuilderwithDamageLocation(@NotNull Location location) Set theLocationof the source of damage.@NotNull DamageSource.BuilderwithDirectEntity(@NotNull Entity entity) Set theEntitythat directly inflicted the damage.
-
Method Details
-
withCausingEntity
Set theEntitythat caused the damage.- Parameters:
entity- the entity- Returns:
- this instance. Allows for chained method calls
- Since:
- 1.20.4
- See Also:
-
withDirectEntity
Set theEntitythat directly inflicted the damage.- Parameters:
entity- the entity- Returns:
- this instance. Allows for chained method calls
- Since:
- 1.20.4
- See Also:
-
withDamageLocation
Set theLocationof the source of damage.- Parameters:
location- the location where the damage occurred- Returns:
- this instance. Allows for chained method calls
- Since:
- 1.20.4
- See Also:
-
withDamageContext
@Experimental @NotNull @NotNull DamageSource.Builder withDamageContext(@NotNull @NotNull Consumer<net.kyori.adventure.pointer.Pointers.Builder> consumer) Configures a builder for thePointersused for plugin-provided damage context.- Parameters:
consumer- a consumer- Returns:
- this instance. Allows for chained method calls
- Since:
- 26.2
- See Also:
-
build
Create a newDamageSourceinstance using the supplied parameters.- Returns:
- the damage source instance
- Since:
- 1.20.4
-