mirror of
https://github.com/PaperMC/Paper.git
synced 2025-07-31 04:02:06 -07:00
Cleanup damage source a bit (#12106)
This commit is contained in:
@@ -51,6 +51,8 @@ public interface DamageSource {
|
||||
* be present if an entity did not cause the damage.
|
||||
*
|
||||
* @return the location, or null if none
|
||||
* @apiNote the world of the location might be null for positioned-only damage source
|
||||
* not caused by any entity
|
||||
*/
|
||||
@Nullable
|
||||
public Location getDamageLocation();
|
||||
@@ -66,6 +68,8 @@ public interface DamageSource {
|
||||
* returned.
|
||||
*
|
||||
* @return the source of the location or null.
|
||||
* @apiNote the world of the location might be null for positioned-only damage source
|
||||
* not caused by any entity
|
||||
*/
|
||||
@Nullable
|
||||
public Location getSourceLocation();
|
||||
|
@@ -23,7 +23,7 @@ public class EntityDamageByBlockEvent extends EntityDamageEvent {
|
||||
|
||||
@Deprecated(since = "1.20.4", forRemoval = true)
|
||||
public EntityDamageByBlockEvent(@Nullable final Block damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, final double damage) {
|
||||
this(damager, (damager != null) ? damager.getState() : null, damagee, cause, (damager != null) ? DamageSource.builder(DamageType.GENERIC).withDamageLocation(damager.getLocation()).build() : DamageSource.builder(DamageType.GENERIC).build(), damage);
|
||||
this(damager, (damager != null) ? damager.getState() : null, damagee, cause, DamageSource.builder(DamageType.GENERIC).build(), damage);
|
||||
}
|
||||
|
||||
public EntityDamageByBlockEvent(@Nullable final Block damager, @Nullable final BlockState damagerState, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final DamageSource damageSource, final double damage) {
|
||||
|
@@ -17,7 +17,7 @@ public class EntityDamageByEntityEvent extends EntityDamageEvent {
|
||||
|
||||
@Deprecated(since = "1.20.4", forRemoval = true)
|
||||
public EntityDamageByEntityEvent(@NotNull final Entity damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, final double damage) {
|
||||
this(damager, damagee, cause, DamageSource.builder(DamageType.GENERIC).withCausingEntity(damager).withDirectEntity(damager).build(), damage);
|
||||
this(damager, damagee, cause, DamageSource.builder(DamageType.GENERIC).build(), damage);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@@ -29,7 +29,7 @@ public class EntityDamageByEntityEvent extends EntityDamageEvent {
|
||||
|
||||
@Deprecated(since = "1.20.4", forRemoval = true)
|
||||
public EntityDamageByEntityEvent(@NotNull final Entity damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final Map<DamageModifier, Double> modifiers, @NotNull final Map<DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions) {
|
||||
this(damager, damagee, cause, DamageSource.builder(DamageType.GENERIC).withCausingEntity(damager).withDirectEntity(damager).build(), modifiers, modifierFunctions);
|
||||
this(damager, damagee, cause, DamageSource.builder(DamageType.GENERIC).build(), modifiers, modifierFunctions);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@@ -65,7 +65,7 @@ public class EntityDamageByEntityEvent extends EntityDamageEvent {
|
||||
* {@inheritDoc}
|
||||
* <p>
|
||||
* The {@link DamageSource#getDirectEntity()} may be different from the {@link #getDamager()}
|
||||
* if the Minecraft damage source did not originally include an damager entity, but one was included
|
||||
* if the damage source did not originally include a damager entity, but one was included
|
||||
* for this event {@link #getDamager()}.
|
||||
*/
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user