summaryrefslogtreecommitdiffstats
path: root/nms-patches/EntityLargeFireball.patch
blob: b64b31f39f71ddbcb3c4944d2aae3301d990ca9f (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
--- ../work/decompile-8eb82bde//net/minecraft/server/EntityLargeFireball.java	2014-11-28 17:43:43.121707434 +0000
+++ src/main/java/net/minecraft/server/EntityLargeFireball.java	2014-11-28 17:38:19.000000000 +0000
@@ -1,5 +1,7 @@
 package net.minecraft.server;
 
+import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
+
 public class EntityLargeFireball extends EntityFireball {
 
     public int yield = 1;
@@ -21,7 +23,16 @@
 
             boolean flag = this.world.getGameRules().getBoolean("mobGriefing");
 
-            this.world.createExplosion((Entity) null, this.locX, this.locY, this.locZ, (float) this.yield, flag, flag);
+            // CraftBukkit start - fire ExplosionPrimeEvent
+            ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.entity.CraftEntity.getEntity(this.world.getServer(), this));
+            this.world.getServer().getPluginManager().callEvent(event);
+
+            if (!event.isCancelled()) {
+                // give 'this' instead of (Entity) null so we know what causes the damage
+                this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), flag);
+            }
+            // CraftBukkit end
+        
             this.die();
         }
 
@@ -35,7 +46,8 @@
     public void a(NBTTagCompound nbttagcompound) {
         super.a(nbttagcompound);
         if (nbttagcompound.hasKeyOfType("ExplosionPower", 99)) {
-            this.yield = nbttagcompound.getInt("ExplosionPower");
+            // CraftBukkit - set bukkitYield when setting explosionpower
+            bukkitYield = this.yield = nbttagcompound.getInt("ExplosionPower");
         }
 
     }