SPIGOT-2719: Comparator and Observer don't trigger BlockRedstoneEvent
By: Amosar <maxi.cass11@gmail.com>
This commit is contained in:
30
paper-server/nms-patches/BlockObserver.patch
Normal file
30
paper-server/nms-patches/BlockObserver.patch
Normal file
@@ -0,0 +1,30 @@
|
||||
--- a/net/minecraft/server/BlockObserver.java
|
||||
+++ b/net/minecraft/server/BlockObserver.java
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
+
|
||||
public class BlockObserver extends BlockDirectional {
|
||||
|
||||
public static final BlockStateBoolean b = BlockProperties.t;
|
||||
@@ -25,8 +27,18 @@
|
||||
|
||||
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
|
||||
if (((Boolean) iblockdata.get(BlockObserver.b)).booleanValue()) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callRedstoneChange(world, blockposition, 15, 0).getNewCurrent() != 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockObserver.b, Boolean.valueOf(false)), 2);
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callRedstoneChange(world, blockposition, 0, 15).getNewCurrent() != 15) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockObserver.b, Boolean.valueOf(true)), 2);
|
||||
world.I().a(blockposition, this, 2);
|
||||
}
|
||||
Reference in New Issue
Block a user