@@ -0,0 +1,53 @@
|
||||
--- a/net/minecraft/server/EntityTNTPrimed.java
|
||||
+++ b/net/minecraft/server/EntityTNTPrimed.java
|
||||
@@ -2,12 +2,16 @@
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
+import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
|
||||
+
|
||||
public class EntityTNTPrimed extends Entity {
|
||||
|
||||
private static final DataWatcherObject<Integer> FUSE_TICKS = DataWatcher.a(EntityTNTPrimed.class, DataWatcherRegistry.b);
|
||||
@Nullable
|
||||
public EntityLiving source;
|
||||
private int fuseTicks;
|
||||
+ public float yield = 4; // CraftBukkit - add field
|
||||
+ public boolean isIncendiary = false; // CraftBukkit - add field
|
||||
|
||||
public EntityTNTPrimed(EntityTypes<? extends EntityTNTPrimed> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -57,10 +61,13 @@
|
||||
|
||||
--this.fuseTicks;
|
||||
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();
|
||||
if (!this.world.isClientSide) {
|
||||
this.explode();
|
||||
}
|
||||
+ this.die();
|
||||
+ // CraftBukkit end
|
||||
} else {
|
||||
this.aK();
|
||||
if (this.world.isClientSide) {
|
||||
@@ -71,9 +78,16 @@
|
||||
}
|
||||
|
||||
private void explode() {
|
||||
- float f = 4.0F;
|
||||
+ // CraftBukkit start
|
||||
+ // float f = 4.0F;
|
||||
|
||||
- this.world.explode(this, this.locX(), this.e(0.0625D), this.locZ(), 4.0F, Explosion.Effect.BREAK);
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) this.getBukkitEntity());
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.world.createExplosion(this, this.locX(), this.e(0.0625D), this.locZ(), event.getRadius(), event.getFire(), Explosion.Effect.BREAK);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@Override
|
||||
Reference in New Issue
Block a user