mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-24 18:07:39 +01:00
54 lines
2.0 KiB
Diff
54 lines
2.0 KiB
Diff
--- a/net/minecraft/server/EntityTNTPrimed.java
|
|
+++ b/net/minecraft/server/EntityTNTPrimed.java
|
|
@@ -1,10 +1,14 @@
|
|
package net.minecraft.server;
|
|
|
|
+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);
|
|
private EntityLiving source;
|
|
private int c;
|
|
+ public float yield = 4; // CraftBukkit - add field
|
|
+ public boolean isIncendiary = false; // CraftBukkit - add field
|
|
|
|
public EntityTNTPrimed(World world) {
|
|
super(world);
|
|
@@ -60,10 +64,13 @@
|
|
|
|
--this.c;
|
|
if (this.c <= 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();
|
|
this.world.addParticle(EnumParticle.SMOKE_NORMAL, this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D, new int[0]);
|
|
@@ -72,9 +79,18 @@
|
|
}
|
|
|
|
private void explode() {
|
|
- float f = 4.0F;
|
|
+ // CraftBukkit start
|
|
+ // float f = 4.0F;
|
|
|
|
- this.world.explode(this, this.locX, this.locY + (double) (this.length / 16.0F), this.locZ, 4.0F, true);
|
|
+ org.bukkit.craftbukkit.CraftServer server = this.world.getServer();
|
|
+
|
|
+ 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 / 16.0F), this.locZ, event.getRadius(), event.getFire(), true);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
protected void b(NBTTagCompound nbttagcompound) {
|