Paper/patches/server/0865-Call-BlockPhysicsEvent-more-often.patch
Nassim Jahnke 4af62f6d1d
Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
2d009e64 Update SnakeYAML javadoc link
b4fd213c Switch Player#updateInventory deprecation for internal API annotation

CraftBukkit Changes:
f3b2b2210 SPIGOT-7376: Exception with getBlockData when hasBlockData is false
725545630 SPIGOT-7375: Fix crash breeding certain entities
b9873b0d4 Update Brigadier version with fix
68b320562 SPIGOT-7266: Found typo in CraftBukkit package
98b4d2ff8 SPIGOT-7372, SPIGOT-7373: Signs can't be edited, issues with SignChangeEvent
5f7bd4d78 SPIGOT-7371: Sign does not open edit text on placement
b4cf99d24 SPIGOT-7371: Fix editing signs with API
a2b6c2744 PR-1200: Implement open sign by side
a345bb940 SPIGOT-7368: Downgrade SpecialSource version

Spigot Changes:
723951c3 Rebuild patches
b655c57d Drop old collision API deprecated since 1.9.4
55b0fed4 Rebuild patches
2023-06-08 15:25:35 +02:00

40 lines
2.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
Date: Sun, 7 Aug 2022 22:16:36 +0200
Subject: [PATCH] Call BlockPhysicsEvent more often
diff --git a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
index a0d035dde5a4976db2d4a9b0ae474e944583f722..ec81be70cd6f92bbf9011395cb361f0ce54c5ad0 100644
--- a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
+++ b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
@@ -119,7 +119,27 @@ public class CollectingNeighborUpdater implements NeighborUpdater {
public boolean runNext(Level world) {
BlockPos blockPos = this.sourcePos.relative(NeighborUpdater.UPDATE_ORDER[this.idx++]);
BlockState blockState = world.getBlockState(blockPos);
- blockState.neighborChanged(world, blockPos, this.sourceBlock, this.sourcePos, false);
+ // Paper start
+ try {
+ boolean cancelled = false;
+ org.bukkit.craftbukkit.CraftWorld cworld = world.getWorld();
+ if (cworld != null) {
+ org.bukkit.event.block.BlockPhysicsEvent event = new org.bukkit.event.block.BlockPhysicsEvent(
+ org.bukkit.craftbukkit.block.CraftBlock.at(world, blockPos),
+ org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(blockState),
+ org.bukkit.craftbukkit.block.CraftBlock.at(world, sourcePos));
+
+ if (!event.callEvent()) {
+ cancelled = true;
+ }
+ }
+ if (!cancelled) { // continue to check for adjacent block (increase idx)
+ blockState.neighborChanged(world, blockPos, this.sourceBlock, this.sourcePos, false);
+ }
+ } catch (StackOverflowError ex) {
+ world.lastPhysicsProblem = new BlockPos(blockPos);
+ }
+ // Paper end
if (this.idx < NeighborUpdater.UPDATE_ORDER.length && NeighborUpdater.UPDATE_ORDER[this.idx] == this.skipDirection) {
++this.idx;
}