Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/nms-patches/EntityLargeFireball.patch

50 Zeilen
2.2 KiB
Diff

2015-05-25 12:37:24 +02:00
--- 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
+
2019-04-23 04:00:00 +02:00
public class EntityLargeFireball extends EntityFireballFireball {
public int yield = 1;
2019-04-23 04:00:00 +02:00
public EntityLargeFireball(EntityTypes<? extends EntityLargeFireball> entitytypes, World world) {
super(entitytypes, world);
2019-06-21 12:00:00 +02:00
+ isIncendiary = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING); // CraftBukkit
}
public EntityLargeFireball(World world, EntityLiving entityliving, double d0, double d1, double d2) {
2019-04-23 04:00:00 +02:00
super(EntityTypes.FIREBALL, entityliving, d0, d1, d2, world);
2019-06-21 12:00:00 +02:00
+ isIncendiary = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING); // CraftBukkit
}
2019-04-23 04:00:00 +02:00
@Override
@@ -24,7 +28,15 @@
2019-06-21 12:00:00 +02:00
boolean flag = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING);
2019-04-23 04:00:00 +02:00
- this.world.createExplosion((Entity) null, this.locX, this.locY, this.locZ, (float) this.yield, flag, flag ? Explosion.Effect.DESTROY : Explosion.Effect.NONE);
+ // CraftBukkit start - fire ExplosionPrimeEvent
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) this.getBukkitEntity());
+ this.world.getServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ // give 'this' instead of (Entity) null so we know what causes the damage
2019-04-23 04:00:00 +02:00
+ this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), flag ? Explosion.Effect.DESTROY : Explosion.Effect.NONE);
+ }
+ // CraftBukkit end
this.die();
}
2019-04-23 04:00:00 +02:00
@@ -40,7 +52,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");
}
}