summaryrefslogtreecommitdiffstats
path: root/nms-patches/BlockDiodeAbstract.patch
blob: 36e5c204d22aaa2c4e3fd5c9f68d6dfa99dd6cd4 (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 AxisAlignedBB c = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.125D, 1.0D);
@@ -35,8 +37,18 @@
             boolean flag = this.e(world, blockposition, iblockdata);
 
             if (this.d && !flag) {
+                // CraftBukkit start
+                if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 15, 0).getNewCurrent() != 0) {
+                    return;
+                }
+                // CraftBukkit end
                 world.setTypeAndData(blockposition, this.y(iblockdata), 2);
             } else if (!this.d) {
+                // CraftBukkit start
+                if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 0, 15).getNewCurrent() != 15) {
+                    return;
+                }
+                // CraftBukkit end
                 world.setTypeAndData(blockposition, this.x(iblockdata), 2);
                 if (!flag) {
                     world.a(blockposition, this.x(iblockdata).getBlock(), this.D(iblockdata), -1);