2015-05-25 12:37:24 +02:00
|
|
|
--- a/net/minecraft/server/EntityTNTPrimed.java
|
|
|
|
+++ b/net/minecraft/server/EntityTNTPrimed.java
|
2016-11-17 02:41:03 +01:00
|
|
|
@@ -1,6 +1,7 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
2016-11-17 02:41:03 +01:00
|
|
|
import javax.annotation.Nullable;
|
2014-11-25 22:32:16 +01:00
|
|
|
+import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
|
2016-11-17 02:41:03 +01:00
|
|
|
|
2014-11-25 22:32:16 +01:00
|
|
|
public class EntityTNTPrimed extends Entity {
|
|
|
|
|
2016-11-17 02:41:03 +01:00
|
|
|
@@ -8,6 +9,8 @@
|
|
|
|
@Nullable
|
2014-11-25 22:32:16 +01:00
|
|
|
private EntityLiving source;
|
2016-02-29 22:32:46 +01:00
|
|
|
private int c;
|
2014-11-25 22:32:16 +01:00
|
|
|
+ public float yield = 4; // CraftBukkit - add field
|
|
|
|
+ public boolean isIncendiary = false; // CraftBukkit - add field
|
|
|
|
|
|
|
|
public EntityTNTPrimed(World world) {
|
|
|
|
super(world);
|
2016-11-17 02:41:03 +01:00
|
|
|
@@ -63,10 +66,13 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2016-02-29 22:32:46 +01:00
|
|
|
--this.c;
|
|
|
|
if (this.c <= 0) {
|
2014-11-25 22:32:16 +01:00
|
|
|
- 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 {
|
2016-06-09 03:43:49 +02:00
|
|
|
this.ak();
|
2014-11-25 22:32:16 +01:00
|
|
|
this.world.addParticle(EnumParticle.SMOKE_NORMAL, this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D, new int[0]);
|
2016-11-17 02:41:03 +01:00
|
|
|
@@ -75,9 +81,17 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private void explode() {
|
|
|
|
- float f = 4.0F;
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ // float f = 4.0F;
|
2015-02-26 23:41:06 +01:00
|
|
|
|
2016-06-09 03:43:49 +02:00
|
|
|
- this.world.explode(this, this.locX, this.locY + (double) (this.length / 16.0F), this.locZ, 4.0F, true);
|
2016-02-29 22:32:46 +01:00
|
|
|
+ org.bukkit.craftbukkit.CraftServer server = this.world.getServer();
|
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()) {
|
2016-06-09 03:43:49 +02:00
|
|
|
+ this.world.createExplosion(this, this.locX, this.locY + (double) (this.length / 16.0F), this.locZ, event.getRadius(), event.getFire(), true);
|
2014-11-25 22:32:16 +01:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void b(NBTTagCompound nbttagcompound) {
|