2015-05-25 12:37:24 +02:00
|
|
|
--- a/net/minecraft/server/EntityTNTPrimed.java
|
|
|
|
+++ b/net/minecraft/server/EntityTNTPrimed.java
|
2014-11-25 22:32:16 +01:00
|
|
|
@@ -1,9 +1,13 @@
|
|
|
|
package net.minecraft.server;
|
|
|
|
|
|
|
|
+import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
|
|
|
|
+
|
|
|
|
public class EntityTNTPrimed extends Entity {
|
|
|
|
|
|
|
|
public int fuseTicks;
|
|
|
|
private EntityLiving source;
|
|
|
|
+ public float yield = 4; // CraftBukkit - add field
|
|
|
|
+ public boolean isIncendiary = false; // CraftBukkit - add field
|
|
|
|
|
|
|
|
public EntityTNTPrimed(World world) {
|
|
|
|
super(world);
|
|
|
|
@@ -52,10 +56,13 @@
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.fuseTicks-- <= 0) {
|
|
|
|
- this.die();
|
|
|
|
+ // CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event
|
|
|
|
+ // this.die();
|
2015-02-26 23:41:06 +01:00
|
|
|
if (!this.world.isClientSide) {
|
2014-11-25 22:32:16 +01:00
|
|
|
this.explode();
|
|
|
|
}
|
|
|
|
+ this.die();
|
|
|
|
+ // CraftBukkit end
|
|
|
|
} else {
|
|
|
|
this.W();
|
|
|
|
this.world.addParticle(EnumParticle.SMOKE_NORMAL, this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D, new int[0]);
|
|
|
|
@@ -64,9 +71,18 @@
|
|
|
|
}
|
|
|
|
|
|
|
|
private void explode() {
|
|
|
|
- float f = 4.0F;
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ // float f = 4.0F;
|
2015-02-26 23:41:06 +01:00
|
|
|
+
|
2014-11-25 22:32:16 +01:00
|
|
|
+ org.bukkit.craftbukkit.CraftServer server = this.world.getServer();
|
2015-02-26 23:41:06 +01:00
|
|
|
|
|
|
|
- this.world.explode(this, this.locX, this.locY + (double) (this.length / 16.0F), this.locZ, f, true);
|
2014-11-25 22:32:16 +01:00
|
|
|
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.entity.CraftEntity.getEntity(server, this));
|
|
|
|
+ server.getPluginManager().callEvent(event);
|
|
|
|
+
|
|
|
|
+ if (!event.isCancelled()) {
|
|
|
|
+ this.world.createExplosion(this, this.locX, this.locY + (double) (this.length / 2.0F), this.locZ, event.getRadius(), event.getFire(), true);
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void b(NBTTagCompound nbttagcompound) {
|