2019-12-16 03:58:10 +01:00
|
|
|
From 5315f77f15062f5a76c11a2e13b3885cc70f49b1 Mon Sep 17 00:00:00 2001
|
2019-01-31 22:45:43 +01:00
|
|
|
From: Zach Brown <zach@zachbr.io>
|
|
|
|
Date: Thu, 31 Jan 2019 16:33:36 -0500
|
|
|
|
Subject: [PATCH] Fire BlockPistonRetractEvent for all empty pistons
|
|
|
|
|
|
|
|
There is an explicit check in the handling code for empty pistons that
|
|
|
|
prevents sticky pistons from firing the event. However when we look back
|
|
|
|
at the history we see that this check was originally added so that ONLY
|
|
|
|
sticky pistons would fire the retract event. I'm not sure why.
|
|
|
|
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/1092acbddf07edfa4100bc6824504ac75088e913
|
|
|
|
|
|
|
|
Over the course of several updates, the meaning of that field appears to
|
|
|
|
have changed from "is NOT sticky" to "is sticky". So now its having the
|
|
|
|
opposite effect. Only normal pistons fire the retraction event. And like
|
|
|
|
all things in CB, it's just been carried around since.
|
|
|
|
|
|
|
|
If we are to believe the history, the correct fix for this issue is to
|
|
|
|
flip it so it only fires for sticky pistons, but that puts us in a
|
|
|
|
bind. It's already firing for non-sticky pistons, changing it now would
|
|
|
|
likely result in breakage. Furthermore, there is little documentation as
|
|
|
|
to WHY that was ever intended to be the case.
|
|
|
|
|
|
|
|
Instead we opt to remove the check entirely so that the event fires for
|
|
|
|
all piston types.
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java
|
2019-12-16 03:58:10 +01:00
|
|
|
index 1170a28107..b29525c40d 100644
|
2019-01-31 22:45:43 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/BlockPiston.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/BlockPiston.java
|
2019-12-12 17:20:43 +01:00
|
|
|
@@ -122,7 +122,7 @@ public class BlockPiston extends BlockDirectional {
|
2019-01-31 22:45:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// CraftBukkit start
|
|
|
|
- if (!this.sticky) {
|
|
|
|
+ //if (!this.sticky) { // Paper - Prevents empty sticky pistons from firing retract - history behind is odd
|
|
|
|
org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
|
|
|
BlockPistonRetractEvent event = new BlockPistonRetractEvent(block, ImmutableList.<org.bukkit.block.Block>of(), CraftBlock.notchToBlockFace(enumdirection));
|
|
|
|
world.getServer().getPluginManager().callEvent(event);
|
2019-12-12 17:20:43 +01:00
|
|
|
@@ -130,7 +130,7 @@ public class BlockPiston extends BlockDirectional {
|
2019-01-31 22:45:43 +01:00
|
|
|
if (event.isCancelled()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
- }
|
|
|
|
+ //} // Paper
|
|
|
|
// PAIL: checkME - what happened to setTypeAndData?
|
|
|
|
// CraftBukkit end
|
2019-12-12 17:20:43 +01:00
|
|
|
world.playBlockAction(blockposition, this, b0, enumdirection.b());
|
2019-01-31 22:45:43 +01:00
|
|
|
--
|
2019-12-12 17:20:43 +01:00
|
|
|
2.24.1
|
2019-01-31 22:45:43 +01:00
|
|
|
|