PaperMC/paper-server/nms-patches/net/minecraft/world/entity/projectile/EntityLargeFireball.patch
CraftBukkit/Spigot 536256d6ff SPIGOT-6508: Rename conflicted getServer
By: md_5 <git@md-5.net>
2021-06-11 21:33:49 +10:00

51 lines
2.4 KiB
Diff

--- a/net/minecraft/world/entity/projectile/EntityLargeFireball.java
+++ b/net/minecraft/world/entity/projectile/EntityLargeFireball.java
@@ -11,17 +11,21 @@
import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.MovingObjectPositionEntity;
+import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
+
public class EntityLargeFireball extends EntityFireballFireball {
public int explosionPower = 1;
public EntityLargeFireball(EntityTypes<? extends EntityLargeFireball> 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
@@ -30,7 +34,15 @@
if (!this.level.isClientSide) {
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
- this.level.createExplosion((Entity) null, this.locX(), this.locY(), this.locZ(), (float) this.explosionPower, flag, flag ? Explosion.Effect.DESTROY : Explosion.Effect.NONE);
+ // 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.createExplosion(this, this.locX(), this.locY(), this.locZ(), event.getRadius(), event.getFire(), flag ? Explosion.Effect.DESTROY : Explosion.Effect.NONE);
+ }
+ // CraftBukkit end
this.die();
}
@@ -61,7 +73,8 @@
public void loadData(NBTTagCompound nbttagcompound) {
super.loadData(nbttagcompound);
if (nbttagcompound.hasKeyOfType("ExplosionPower", 99)) {
- this.explosionPower = nbttagcompound.getByte("ExplosionPower");
+ // CraftBukkit - set bukkitYield when setting explosionpower
+ bukkitYield = this.explosionPower = nbttagcompound.getByte("ExplosionPower");
}
}