summaryrefslogtreecommitdiffstats
path: root/nms-patches/ItemFireball.patch
blob: aa84efa135d48a338826407ee68ffa1fb3f149f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
--- a/net/minecraft/server/ItemFireball.java
+++ b/net/minecraft/server/ItemFireball.java
@@ -17,6 +17,14 @@
                 return EnumInteractionResult.FAIL;
             } else {
                 if (world.getType(blockposition).getMaterial() == Material.AIR) {
+                    // CraftBukkit start - fire BlockIgniteEvent
+                    if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FIREBALL, entityhuman).isCancelled()) {
+                        if (!entityhuman.abilities.canInstantlyBuild) {
+                            itemstack.subtract(1);
+                        }
+                        return EnumInteractionResult.PASS;
+                    }
+                    // CraftBukkit end
                     world.a((EntityHuman) null, blockposition, SoundEffects.bD, SoundCategory.BLOCKS, 1.0F, (ItemFireball.j.nextFloat() - ItemFireball.j.nextFloat()) * 0.2F + 1.0F);
                     world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData());
                 }