13
0
geforkt von Mirrors/Paper

Add source block to BlockPhysicsEvent

Dieser Commit ist enthalten in:
Lulu13022002 2022-08-07 22:16:36 +02:00
Ursprung 476de68a14
Commit a45d2c6068
2 geänderte Dateien mit 20 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -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++;
}

Datei anzeigen

@ -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()) {