summaryrefslogtreecommitdiffstats
path: root/nms-patches/ItemFireball.patch
blob: b102662b8bd30d76ee8e47d65d19b16511d8986d (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
@@ -15,6 +15,14 @@
             BlockPosition blockposition = itemactioncontext.getClickPosition().shift(itemactioncontext.getClickedFace());
 
             if (world.getType(blockposition).isAir()) {
+                // CraftBukkit start - fire BlockIgniteEvent
+                if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FIREBALL, itemactioncontext.getEntity()).isCancelled()) {
+                    if (!itemactioncontext.getEntity().abilities.canInstantlyBuild) {
+                        itemactioncontext.getItemStack().subtract(1);
+                    }
+                    return EnumInteractionResult.PASS;
+                }
+                // CraftBukkit end
                 world.a((EntityHuman) null, blockposition, SoundEffects.ITEM_FIRECHARGE_USE, SoundCategory.BLOCKS, 1.0F, (ItemFireball.i.nextFloat() - ItemFireball.i.nextFloat()) * 0.2F + 1.0F);
                 world.setTypeUpdate(blockposition, ((BlockFire) Blocks.FIRE).a((IBlockAccess) world, blockposition));
             }