summaryrefslogtreecommitdiffstats
path: root/nms-patches/BlockRedstoneLamp.patch
blob: 422cfd556643a8507535498c02b90db95cbe06da (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
31
32
33
34
35
--- a/net/minecraft/server/BlockRedstoneLamp.java
+++ b/net/minecraft/server/BlockRedstoneLamp.java
@@ -3,6 +3,8 @@
 import java.util.Random;
 import javax.annotation.Nullable;
 
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
 public class BlockRedstoneLamp extends Block {
 
     public static final BlockStateBoolean a = BlockRedstoneTorch.LIT;
@@ -33,6 +35,11 @@
                 if (flag) {
                     world.getBlockTickList().a(blockposition, this, 4);
                 } else {
+                    // CraftBukkit start
+                    if (CraftEventFactory.callRedstoneChange(world, blockposition, 0, 15).getNewCurrent() != 15) {
+                        return;
+                    }
+                    // CraftBukkit end
                     world.setTypeAndData(blockposition, (IBlockData) iblockdata.a((IBlockState) BlockRedstoneLamp.a), 2);
                 }
             }
@@ -43,6 +50,11 @@
     public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
         if (!world.isClientSide) {
             if ((Boolean) iblockdata.get(BlockRedstoneLamp.a) && !world.isBlockIndirectlyPowered(blockposition)) {
+                // CraftBukkit start
+                if (CraftEventFactory.callRedstoneChange(world, blockposition, 15, 0).getNewCurrent() != 0) {
+                    return;
+                }
+                // CraftBukkit end
                 world.setTypeAndData(blockposition, (IBlockData) iblockdata.a((IBlockState) BlockRedstoneLamp.a), 2);
             }