--- a/net/minecraft/world/entity/projectile/EntityLargeFireball.java +++ b/net/minecraft/world/entity/projectile/EntityLargeFireball.java @@ -9,17 +9,24 @@ import net.minecraft.world.phys.MovingObjectPosition; import net.minecraft.world.phys.MovingObjectPositionEntity; +// CraftBukkit start +import org.bukkit.event.entity.EntityRemoveEvent; +import org.bukkit.event.entity.ExplosionPrimeEvent; +// CraftBukkit end + public class EntityLargeFireball extends EntityFireballFireball { public int explosionPower = 1; public EntityLargeFireball(EntityTypes entitytypes, World world) { super(entitytypes, world); + isIncendiary = this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); // CraftBukkit } public EntityLargeFireball(World world, EntityLiving entityliving, double d0, double d1, double d2, int i) { super(EntityTypes.FIREBALL, entityliving, d0, d1, d2, world); this.explosionPower = i; + isIncendiary = this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); // CraftBukkit } @Override @@ -28,8 +35,16 @@ if (!this.level().isClientSide) { boolean flag = this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); - this.level().explode(this, this.getX(), this.getY(), this.getZ(), (float) this.explosionPower, flag, World.a.MOB); - this.discard(); + // CraftBukkit start - fire ExplosionPrimeEvent + ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) this.getBukkitEntity()); + this.level().getCraftServer().getPluginManager().callEvent(event); + + if (!event.isCancelled()) { + // give 'this' instead of (Entity) null so we know what causes the damage + this.level().explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), World.a.MOB); + } + // CraftBukkit end + this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause } } @@ -59,7 +74,8 @@ public void readAdditionalSaveData(NBTTagCompound nbttagcompound) { super.readAdditionalSaveData(nbttagcompound); if (nbttagcompound.contains("ExplosionPower", 99)) { - this.explosionPower = nbttagcompound.getByte("ExplosionPower"); + // CraftBukkit - set bukkitYield when setting explosionpower + bukkitYield = this.explosionPower = nbttagcompound.getByte("ExplosionPower"); } }