--- a/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java +++ b/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java @@ -26,6 +26,11 @@ import net.minecraft.world.level.block.state.IBlockData; import net.minecraft.world.level.material.Fluid; +// CraftBukkit start +import org.bukkit.event.entity.EntityRemoveEvent; +import org.bukkit.event.entity.ExplosionPrimeEvent; +// CraftBukkit end + public class EntityMinecartTNT extends EntityMinecartAbstract { private static final byte EVENT_PRIME = 10; @@ -33,6 +38,7 @@ private static final float DEFAULT_EXPLOSION_POWER_BASE = 4.0F; public int fuse = -1; public float explosionPowerBase = 4.0F; + public boolean isIncendiary = false; // CraftBukkit - add field public EntityMinecartTNT(EntityTypes entitytypes, World world) { super(entitytypes, world); @@ -113,8 +119,16 @@ if (world instanceof WorldServer worldserver) { double d1 = Math.min(Math.sqrt(d0), 5.0D); - worldserver.explode(this, damagesource, (ExplosionDamageCalculator) null, this.getX(), this.getY(), this.getZ(), (float) ((double) this.explosionPowerBase + this.random.nextDouble() * 1.5D * d1), false, World.a.TNT); - this.discard(); + // CraftBukkit start + ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), (float) ((double) this.explosionPowerBase + this.random.nextDouble() * 1.5D * d1), this.isIncendiary); + worldserver.getCraftServer().getPluginManager().callEvent(event); + if (event.isCancelled()) { + fuse = -1; + return; + } + worldserver.explode(this, damagesource, (ExplosionDamageCalculator) null, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), World.a.TNT); + // CraftBukkit end + this.discard(EntityRemoveEvent.Cause.EXPLODE); // CraftBukkit - add Bukkit remove cause } }