Paper/nms-patches/EntityLargeFireball.patch

38 lines
1.6 KiB
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/EntityLargeFireball.java
+++ b/net/minecraft/server/EntityLargeFireball.java
@@ -1,5 +1,7 @@
package net.minecraft.server;
+import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
+
public class EntityLargeFireball extends EntityFireball {
public int yield = 1;
2015-02-26 23:41:06 +01:00
@@ -21,7 +23,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(), flag);
+ }
+ // CraftBukkit end
this.die();
}
2016-06-09 03:43:49 +02:00
@@ -39,7 +49,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");
}
}