summaryrefslogtreecommitdiffstats
path: root/nms-patches/BlockDiodeAbstract.patch
blob: 30cf95abe99c7a773ac7ea742311f9efaaff2419 (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/BlockDiodeAbstract.java
+++ b/net/minecraft/server/BlockDiodeAbstract.java
@@ -2,6 +2,8 @@
 
 import java.util.Random;
 
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
 public abstract class BlockDiodeAbstract extends BlockFacingHorizontal {
 
     protected static final VoxelShape b = Block.a(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D);
@@ -29,8 +31,18 @@
             boolean flag1 = this.a(world, blockposition, iblockdata);
 
             if (flag && !flag1) {
+                // CraftBukkit start
+                if (CraftEventFactory.callRedstoneChange(world, blockposition, 15, 0).getNewCurrent() != 0) {
+                    return;
+                }
+                // CraftBukkit end
                 world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockDiodeAbstract.c, Boolean.valueOf(false)), 2);
             } else if (!flag) {
+                // CraftBukkit start
+                if (CraftEventFactory.callRedstoneChange(world, blockposition, 0, 15).getNewCurrent() != 15) {
+                    return;
+                }
+                // CraftBukkit end
                 world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockDiodeAbstract.c, Boolean.valueOf(true)), 2);
                 if (!flag1) {
                     world.I().a(blockposition, this, this.k(iblockdata), TickListPriority.HIGH);