summaryrefslogtreecommitdiffstats
path: root/nms-patches/BlockObserver.patch
blob: 592fe5ac47500125bc94ae1c07a81043d03b74a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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)) {
+            // CraftBukkit start
+            if (CraftEventFactory.callRedstoneChange(world, blockposition, 15, 0).getNewCurrent() != 0) {
+                return;
+            }
+            // CraftBukkit end
             world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockObserver.b, 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, true), 2);
             world.J().a(blockposition, this, 2);
         }