mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-15 14:13:56 +01:00
Add source block to BlockPhysicsEvent
This commit is contained in:
parent
476de68a14
commit
a45d2c6068
2 changed files with 20 additions and 2 deletions
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
|
||||
+++ b/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
|
||||
@@ -135,7 +135,7 @@
|
||||
orientation = this.orientation.withFront(direction);
|
||||
}
|
||||
|
||||
- NeighborUpdater.executeUpdate(world, blockState, blockPos, this.sourceBlock, orientation, false);
|
||||
+ NeighborUpdater.executeUpdate(world, blockState, blockPos, this.sourceBlock, orientation, false, this.sourcePos); // Paper - Add source block to BlockPhysicsEvent
|
||||
if (this.idx < NeighborUpdater.UPDATE_ORDER.length && NeighborUpdater.UPDATE_ORDER[this.idx] == this.skipDirection) {
|
||||
this.idx++;
|
||||
}
|
|
@ -18,14 +18,21 @@
|
|||
|
||||
public interface NeighborUpdater {
|
||||
|
||||
@@ -50,7 +56,22 @@
|
||||
@@ -49,8 +55,29 @@
|
||||
}
|
||||
|
||||
static void executeUpdate(Level world, BlockState state, BlockPos pos, Block sourceBlock, @Nullable Orientation orientation, boolean notify) {
|
||||
+ // Paper start - Add source block to BlockPhysicsEvent
|
||||
+ executeUpdate(world, state, pos, sourceBlock, orientation, notify, pos);
|
||||
+ }
|
||||
+
|
||||
+ static void executeUpdate(Level world, BlockState state, BlockPos pos, Block sourceBlock, @Nullable Orientation orientation, boolean notify, BlockPos sourcePos) {
|
||||
+ // Paper end - Add source block to BlockPhysicsEvent
|
||||
try {
|
||||
+ // CraftBukkit start
|
||||
+ CraftWorld cworld = ((ServerLevel) world).getWorld();
|
||||
+ if (cworld != null) {
|
||||
+ BlockPhysicsEvent event = new BlockPhysicsEvent(CraftBlock.at(world, pos), CraftBlockData.fromData(state));
|
||||
+ BlockPhysicsEvent event = new BlockPhysicsEvent(CraftBlock.at(world, pos), CraftBlockData.fromData(state), CraftBlock.at(world, sourcePos)); // Paper - Add source block to BlockPhysicsEvent
|
||||
+ ((ServerLevel) world).getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
|
|
Loading…
Reference in a new issue