38 lines
2.9 KiB
Diff
38 lines
2.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: lexikiq <noellekiq@gmail.com>
|
|
Date: Fri, 18 Jun 2021 14:04:39 -0400
|
|
Subject: [PATCH] Add origin location to EntityDamageByBlockEvent
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
index dfd54e3f9016635c986afdb613c94be9bec91237..c7056a714cecb4c2190bc5e85bf4ac3812640f6c 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
@@ -1063,7 +1063,7 @@ public class CraftEventFactory {
|
|
CraftEventFactory.entityDamage = null;
|
|
EntityDamageEvent event;
|
|
if (damager == null) {
|
|
- event = new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), DamageCause.BLOCK_EXPLOSION, modifiers, modifierFunctions, source.explodedBlockState); // Paper - handle block state in damage
|
|
+ event = new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), DamageCause.BLOCK_EXPLOSION, modifiers, modifierFunctions, source.explodedBlockState, source.getEntity().getBukkitEntity().getLocation()); // Paper - handle block state in damage
|
|
} else if (entity instanceof EnderDragon && /*PAIL FIXME ((EntityEnderDragon) entity).target == damager*/ false) {
|
|
event = new EntityDamageEvent(entity.getBukkitEntity(), DamageCause.ENTITY_EXPLOSION, modifiers, modifierFunctions);
|
|
} else {
|
|
@@ -1111,7 +1111,7 @@ public class CraftEventFactory {
|
|
|
|
return CraftEventFactory.callEntityDamageEvent(damager, entity, cause, modifiers, modifierFunctions, cancelled, source.isCritical()); // Paper - add critical damage API
|
|
} else if (source.is(DamageTypes.FELL_OUT_OF_WORLD)) {
|
|
- EntityDamageEvent event = new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), DamageCause.VOID, modifiers, modifierFunctions);
|
|
+ EntityDamageEvent event = new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), DamageCause.VOID, modifiers, modifierFunctions, null, entity.getBukkitEntity().getLocation());
|
|
event.setCancelled(cancelled);
|
|
CraftEventFactory.callEvent(event);
|
|
if (!event.isCancelled()) {
|
|
@@ -1121,7 +1121,7 @@ public class CraftEventFactory {
|
|
}
|
|
return event;
|
|
} else if (source.is(DamageTypes.LAVA)) {
|
|
- EntityDamageEvent event = (new EntityDamageByBlockEvent(CraftEventFactory.blockDamage, entity.getBukkitEntity(), DamageCause.LAVA, modifiers, modifierFunctions));
|
|
+ EntityDamageEvent event = (new EntityDamageByBlockEvent(CraftEventFactory.blockDamage, entity.getBukkitEntity(), DamageCause.LAVA, modifiers, modifierFunctions, null, blockDamage.getLocation()));
|
|
event.setCancelled(cancelled);
|
|
|
|
Block damager = CraftEventFactory.blockDamage;
|