summaryrefslogtreecommitdiffstats
path: root/nms-patches/FluidTypeLava.patch
blob: 32cbc489feb3e099144c9af1ca30b95e04c6cdad (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
--- a/net/minecraft/server/FluidTypeLava.java
+++ b/net/minecraft/server/FluidTypeLava.java
@@ -35,6 +35,13 @@
 
                     if (iblockdata.isAir()) {
                         if (this.a((IWorldReader) world, blockposition1)) {
+                            // CraftBukkit start - Prevent lava putting something on fire
+                            if (world.getType(blockposition1) != Blocks.FIRE) {
+                                if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition1, blockposition).isCancelled()) {
+                                    continue;
+                                }
+                            }
+                            // CraftBukkit end
                             world.setTypeUpdate(blockposition1, Blocks.FIRE.getBlockData());
                             return;
                         }
@@ -51,6 +58,14 @@
                     }
 
                     if (world.isEmpty(blockposition2.up()) && this.b(world, blockposition2)) {
+                        // CraftBukkit start - Prevent lava putting something on fire
+                        BlockPosition up = blockposition2.up();
+                        if (world.getType(up) != Blocks.FIRE) {
+                            if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, up, blockposition).isCancelled()) {
+                                continue;
+                            }
+                        }
+                        // CraftBukkit end
                         world.setTypeUpdate(blockposition2.up(), Blocks.FIRE.getBlockData());
                     }
                 }
@@ -139,7 +154,11 @@
 
             if (this.a(TagsFluid.LAVA) && fluid1.a(TagsFluid.WATER)) {
                 if (iblockdata.getBlock() instanceof BlockFluids) {
-                    generatoraccess.setTypeAndData(blockposition, Blocks.STONE.getBlockData(), 3);
+                    // CraftBukkit start
+                    if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(generatoraccess.getMinecraftWorld(), blockposition, Blocks.STONE.getBlockData(), 3)) {
+                        return;
+                    }
+                    // CraftBukkit end
                 }
 
                 this.a(generatoraccess, blockposition);