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 Details

    • withCausingEntity

      @NotNull @NotNull DamageSource.Builder withCausingEntity(@NotNull @NotNull Entity entity)
      Set the Entity that caused the damage.
      Parameters:
      entity - the entity
      Returns:
      this instance. Allows for chained method calls
      Since:
      1.20.4
      See Also:
    • withDirectEntity

      @NotNull @NotNull DamageSource.Builder withDirectEntity(@NotNull @NotNull Entity entity)
      Set the Entity that directly inflicted the damage.
      Parameters:
      entity - the entity
      Returns:
      this instance. Allows for chained method calls
      Since:
      1.20.4
      See Also:
    • withDamageLocation

      @NotNull @NotNull DamageSource.Builder withDamageLocation(@NotNull @NotNull Location location)
      Set the Location of 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 the Pointers used for plugin-provided damage context.
      Parameters:
      consumer - a consumer
      Returns:
      this instance. Allows for chained method calls
      Since:
      26.2
      See Also:
    • build

      @NotNull @NotNull DamageSource build()
      Create a new DamageSource instance using the supplied parameters.
      Returns:
      the damage source instance
      Since:
      1.20.4