mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-27 04:55:47 +01:00
50 lines
2.1 KiB
Diff
50 lines
2.1 KiB
Diff
--- a/net/minecraft/server/EntityLargeFireball.java
|
|
+++ b/net/minecraft/server/EntityLargeFireball.java
|
|
@@ -1,15 +1,19 @@
|
|
package net.minecraft.server;
|
|
|
|
+import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
|
|
+
|
|
public class EntityLargeFireball extends EntityFireball {
|
|
|
|
public int yield = 1;
|
|
|
|
public EntityLargeFireball(World world) {
|
|
super(EntityTypes.FIREBALL, world, 1.0F, 1.0F);
|
|
+ isIncendiary = this.world.getGameRules().getBoolean("mobGriefing"); // CraftBukkit
|
|
}
|
|
|
|
public EntityLargeFireball(World world, EntityLiving entityliving, double d0, double d1, double d2) {
|
|
super(EntityTypes.FIREBALL, entityliving, d0, d1, d2, world, 1.0F, 1.0F);
|
|
+ isIncendiary = this.world.getGameRules().getBoolean("mobGriefing"); // CraftBukkit
|
|
}
|
|
|
|
protected void a(MovingObjectPosition movingobjectposition) {
|
|
@@ -21,7 +25,15 @@
|
|
|
|
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(), isIncendiary);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
this.die();
|
|
}
|
|
|
|
@@ -35,7 +47,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");
|
|
}
|
|
|
|
}
|