mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 07:20:00 +08:00
835bc39b03
Updated Upstream (Bukkit/CraftBukkit/Spigot) Bukkit Changes: 2dcc44dc SPIGOT-4307: Fix hacky API for banners on shields e0fc6572 SPIGOT-4309: Add "forced" display of particles efeeab2f Add index to README.md for easier navigation f502bc6f Update to Minecraft 1.13.1 CraftBukkit Changes:d0bb0a1d
Fix some tests randomly failing997d378d
Fix client stall in specific teleportation scenariosb3dc2366
SPIGOT-4307: Fix hacky API for banners on shields2a271162
SPIGOT-4301: Fix more invalid enchants5d0d83bb
SPIGOT-4309: Add "forced" display of particlesa6772578
Add additional tests for CraftBlockDatace1af0c3
Update to Minecraft 1.13.1 Spigot Changes: 2440e189 Rebuild patches 4ecffced Update to Minecraft 1.13.1
49 lines
1.7 KiB
Diff
49 lines
1.7 KiB
Diff
From a924b59822d15436017aaa9ab10288a06f7e5263 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 5e47eabe8..9d9e4712b 100644
|
|
--- a/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java
|
|
+++ b/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java
|
|
@@ -29,10 +29,34 @@ public class BlockPhysicsEvent extends BlockEvent implements Cancellable {
|
|
private static final HandlerList handlers = new HandlerList();
|
|
private final BlockData changed;
|
|
private boolean cancel = false;
|
|
+ // Paper start - add source block
|
|
+ private int sourceX;
|
|
+ private int sourceY;
|
|
+ private int sourceZ;
|
|
+ private Block sourceBlock;
|
|
+
|
|
+ public BlockPhysicsEvent(final Block block, final BlockData changed, final int sourceX, final int sourceY, final int sourceZ) {
|
|
+ this(block, changed);
|
|
+ this.sourceX = sourceX;
|
|
+ this.sourceY = sourceY;
|
|
+ this.sourceZ = sourceZ;
|
|
+ this.sourceBlock = null;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Gets the source block, causing this event
|
|
+ *
|
|
+ * @return Source block
|
|
+ */
|
|
+ public Block getSourceBlock() {
|
|
+ return sourceBlock == null ? (sourceBlock = block.getWorld().getBlockAt(sourceX, sourceY, sourceZ)) : sourceBlock;
|
|
+ }
|
|
+ // Paper end
|
|
|
|
public BlockPhysicsEvent(final Block block, final BlockData changed) {
|
|
super(block);
|
|
this.changed = changed;
|
|
+ this.sourceBlock = block; // Paper - add source block
|
|
}
|
|
|
|
/**
|
|
--
|
|
2.18.0
|
|
|