Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@171ba7c Move Log4j plugins to own source set (#9428) PaperMC/Paper@4356758 Call missing BlockDispenseEvents (#8518) PaperMC/Paper@c0936a7 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9440) PaperMC/Paper@12c9700 Fix ThrownEggHatchEvent#setHatching (#9448) PaperMC/Paper@dadd8b5 Don't allow for supporting block checks to load chunks PaperMC/Paper@48ea66e Optimize player lookups for beacons PaperMC/Paper@d7d3f63 Use Nullable annotation for Entity source (#9435) PaperMC/Paper@e105354 Fix incorrect new blockdata in EntityChangeBlockEvent (#9445) PaperMC/Paper@5de0f8a Add Sign#getInteractableSideFor (#9388) PaperMC/Paper@6b325cd Array backed synched entity data (#9460) PaperMC/Paper@805fdd8 Add deprecations to SignSide string methods (#9467) PaperMC/Paper@b3dc7a3 fix item meta for tadpole buckets (#9473) PaperMC/Paper@f9473d9 Add gradle wrapper validation action PaperMC/Paper@a3c760e Handle block state in EntityDamageByBlockEvent (#9396) PaperMC/Paper@a60eeb8 Fix mob breaking doors not spawning particles (#9443) PaperMC/Paper@1f8ca77 Prevent desync for poi and pistons (#9270) PaperMC/Paper@92bc19b Fix missing item interaction cancelling case (#9427) PaperMC/Paper@836586d Fix missing item types in SlotType for armor change event (#9379) PaperMC/Paper@ece4fd3 Suppress Item Meta Validation Checks (#9331) PaperMC/Paper@aefb73c Add Owner UUID api for AreaEffectCloud (#9364) PaperMC/Paper@22ed60c Fix BanList API (#9450) PaperMC/Paper@de3f149 Fix possible NPE on painting creation (#9391) PaperMC/Paper@fe780d0 Add back accidentally dropped Wandering Trader patch (#9492) PaperMC/Paper@b533905 fix 2 vanilla issues (#8940) PaperMC/Paper@c793bd9 Allow LEFT_CLICK_AIR in 3.0->4.5 range of entity (#9211)
63 lines
3.4 KiB
Diff
63 lines
3.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: lexikiq <noellekiq@gmail.com>
|
|
Date: Fri, 18 Jun 2021 14:06:43 -0400
|
|
Subject: [PATCH] Add origin location to EntityDamageByBlockEvent
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java b/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java
|
|
index ab18f35b686ec79551c307dde9e43c7dfad1b182..47c522e31d704d6c36fbfe128c97cba234932bc7 100644
|
|
--- a/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java
|
|
+++ b/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java
|
|
@@ -17,6 +17,7 @@ import org.jetbrains.annotations.Nullable;
|
|
public class EntityDamageByBlockEvent extends EntityDamageEvent {
|
|
private final Block damager;
|
|
private final org.bukkit.block.BlockState damagerBlockState; // Paper
|
|
+ private final org.bukkit.Location location; // Parchment
|
|
|
|
public EntityDamageByBlockEvent(@Nullable final Block damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, final double damage) {
|
|
// Paper start
|
|
@@ -28,21 +29,41 @@ public class EntityDamageByBlockEvent extends EntityDamageEvent {
|
|
super(damagee, cause, damage);
|
|
this.damager = damager;
|
|
this.damagerBlockState = damagerBlockState; // Paper
|
|
+ this.location = damager != null ? damager.getLocation() : null; // Parchment
|
|
}
|
|
|
|
public EntityDamageByBlockEvent(@Nullable final Block 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) {
|
|
// Paper start
|
|
- this(damager, damagee, cause, modifiers, modifierFunctions, null);
|
|
+ this(damager, damagee, cause, modifiers, modifierFunctions, null, null);
|
|
}
|
|
|
|
@org.jetbrains.annotations.ApiStatus.Internal
|
|
- public EntityDamageByBlockEvent(@Nullable final Block 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, final @Nullable org.bukkit.block.BlockState damagerBlockState) {
|
|
+ public EntityDamageByBlockEvent(@Nullable final Block 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, final @Nullable org.bukkit.block.BlockState damagerBlockState, @Nullable final org.bukkit.Location damageLocation) { // Parchment
|
|
// Paper end
|
|
super(damagee, cause, modifiers, modifierFunctions);
|
|
this.damager = damager;
|
|
this.damagerBlockState = damagerBlockState; // Paper
|
|
+ // Parchment start
|
|
+ if (damageLocation != null)
|
|
+ this.location = damageLocation;
|
|
+ else if (damager != null)
|
|
+ this.location = damager.getLocation();
|
|
+ else
|
|
+ this.location = null;
|
|
+ // Parchment end
|
|
}
|
|
|
|
+ /**
|
|
+ * Gets the location of the damage source.
|
|
+ *
|
|
+ * @return Originating location of the damage source
|
|
+ */
|
|
+ @Nullable
|
|
+ public org.bukkit.Location getLocation() {
|
|
+ return location;
|
|
+ }
|
|
+ // Parchment end
|
|
+
|
|
/**
|
|
* Returns the block that damaged the player.
|
|
*
|