Paper/Spigot-API-Patches/0143-Add-source-block-to-BlockPhysicsEvent.patch

28 lines
1.1 KiB
Diff
Raw Normal View History

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
2018-08-24 17:57:11 +02:00
+ 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