aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0938-Fix-DamageCause-for-Falling-Blocks.patch
blob: 6490952e0efb79184f34afb5e98e17795e6f57c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Doc <nachito94@msn.com>
Date: Mon, 1 May 2023 13:34:57 -0400
Subject: [PATCH] Fix DamageCause for Falling Blocks


diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index a2af7cdc6e538e844f354b2acb30ae3d6e103533..7c0fec2df265bc72cb5e2f8f400c6ad4c128705e 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1086,6 +1086,11 @@ public class CraftEventFactory {
             } else if (source.is(DamageTypes.SONIC_BOOM)) {
                 cause = DamageCause.SONIC_BOOM;
             }
+            // Paper start - fix handle of Falling Blocks
+            else if (source.is(DamageTypes.FALLING_STALACTITE) || source.is(DamageTypes.FALLING_BLOCK) || source.is(DamageTypes.FALLING_ANVIL)) {
+                cause = DamageCause.FALLING_BLOCK;
+            }
+            // Paper end
 
             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)) {