aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-API-Patches/0143-Add-source-block-to-BlockPhysicsEvent.patch
blob: 173f856fd81b7c5485d48e01cf208dfd2999e053 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
From c273ba5e5fbb6580371f21b58d31659fa105de33 Mon Sep 17 00:00:00 2001
From: Sotr <i@omc.hk>
Date: Thu, 23 Aug 2018 16:14:25 +0800
Subject: [PATCH] Add source block to BlockPhysicsEvent


diff --git a/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java b/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java
index 75d4e70f5..a28731dc2 100644
--- a/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java
+++ b/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java
@@ -32,6 +32,13 @@ public class BlockPhysicsEvent extends BlockEvent implements Cancellable {
     private final Block sourceBlock;
     private boolean cancel = false;
 
+    // Paper start - Legacy constructor, use #BlockPhysicsEvent(Block, BlockData, Block)
+    @Deprecated
+    public BlockPhysicsEvent(final Block block, final BlockData changed, final int sourceX, final int sourceY, final int sourceZ) {
+        this(block, changed, block.getWorld().getBlockAt(sourceX, sourceY, sourceZ));
+    }
+    // Paper end
+
     public BlockPhysicsEvent(@NotNull final Block block, @NotNull final BlockData changed) {
         this(block, changed, block);
     }
-- 
2.21.0