summaryrefslogtreecommitdiffstats
path: root/nms-patches/BlockVine.patch
blob: f309579c64fdc5571e99b476c697aa71457daa14 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
--- a/net/minecraft/server/BlockVine.java
+++ b/net/minecraft/server/BlockVine.java
@@ -7,6 +7,8 @@
 import java.util.function.Predicate;
 import javax.annotation.Nullable;
 
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
 public class BlockVine extends Block {
 
     public static final BlockStateBoolean UP = BlockSprawling.p;
@@ -183,20 +185,24 @@
                             BlockPosition blockposition3 = blockposition2.shift(enumdirection1);
                             BlockPosition blockposition4 = blockposition2.shift(enumdirection2);
 
+                            // CraftBukkit start - Call BlockSpreadEvent
+                            BlockPosition source = blockposition;
+
                             if (flag && this.b((IBlockAccess) world, blockposition3, enumdirection1)) {
-                                world.setTypeAndData(blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection1), Boolean.valueOf(true)), 2);
+                                CraftEventFactory.handleBlockSpreadEvent(world, source, blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection1), Boolean.valueOf(true)), 2);
                             } else if (flag1 && this.b((IBlockAccess) world, blockposition4, enumdirection2)) {
-                                world.setTypeAndData(blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection2), Boolean.valueOf(true)), 2);
+                                CraftEventFactory.handleBlockSpreadEvent(world, source, blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection2), Boolean.valueOf(true)), 2);
                             } else {
                                 EnumDirection enumdirection3 = enumdirection.opposite();
 
                                 if (flag && world.isEmpty(blockposition3) && this.b((IBlockAccess) world, blockposition.shift(enumdirection1), enumdirection3)) {
-                                    world.setTypeAndData(blockposition3, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), Boolean.valueOf(true)), 2);
+                                    CraftEventFactory.handleBlockSpreadEvent(world, source, blockposition3, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), Boolean.valueOf(true)), 2);
                                 } else if (flag1 && world.isEmpty(blockposition4) && this.b((IBlockAccess) world, blockposition.shift(enumdirection2), enumdirection3)) {
-                                    world.setTypeAndData(blockposition4, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), Boolean.valueOf(true)), 2);
+                                    CraftEventFactory.handleBlockSpreadEvent(world, source, blockposition4, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), Boolean.valueOf(true)), 2);
                                 } else if ((double) world.random.nextFloat() < 0.05D && this.b((IBlockAccess) world, blockposition2.up(), EnumDirection.UP)) {
-                                    world.setTypeAndData(blockposition2, (IBlockData) this.getBlockData().set(BlockVine.UP, Boolean.valueOf(true)), 2);
+                                    CraftEventFactory.handleBlockSpreadEvent(world, source, blockposition2, (IBlockData) this.getBlockData().set(BlockVine.UP, Boolean.valueOf(true)), 2);
                                 }
+                                // CraftBukkit end
                             }
                         } else if (this.b((IBlockAccess) world, blockposition2, enumdirection)) {
                             world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(getDirection(enumdirection), Boolean.valueOf(true)), 2);
@@ -226,7 +232,7 @@
                             }
 
                             if (this.x(iblockdata3)) {
-                                world.setTypeAndData(blockposition1, iblockdata3, 2);
+                                CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition1, iblockdata3, 2); // CraftBukkit
                             }
 
                             return;
@@ -241,7 +247,7 @@
                             IBlockData iblockdata5 = this.a(iblockdata, iblockdata4, random);
 
                             if (iblockdata4 != iblockdata5 && this.x(iblockdata5)) {
-                                world.setTypeAndData(blockposition2, iblockdata5, 2);
+                                CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition2, iblockdata5, 2); // CraftBukkit
                             }
                         }
                     }