mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-25 09:34:44 +01:00
ad8f95c3df
By: Parker Hawke <hawkeboyz2@hotmail.com>
44 lines
1.7 KiB
Diff
44 lines
1.7 KiB
Diff
--- a/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java
|
|
+++ b/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java
|
|
@@ -23,10 +23,14 @@
|
|
import net.minecraft.world.level.block.state.IBlockData;
|
|
import net.minecraft.world.level.material.Fluid;
|
|
|
|
+// CraftBukkit start
|
|
+import org.bukkit.event.entity.ExplosionPrimeEvent;
|
|
+// CraftBukkit end
|
|
+
|
|
public class EntityMinecartTNT extends EntityMinecartAbstract {
|
|
|
|
private static final byte EVENT_PRIME = 10;
|
|
- private int fuse = -1;
|
|
+ public int fuse = -1;
|
|
|
|
public EntityMinecartTNT(EntityTypes<? extends EntityMinecartTNT> entitytypes, World world) {
|
|
super(entitytypes, world);
|
|
@@ -103,7 +107,7 @@
|
|
return Items.TNT_MINECART;
|
|
}
|
|
|
|
- protected void explode(double d0) {
|
|
+ public void explode(double d0) {
|
|
this.explode((DamageSource) null, d0);
|
|
}
|
|
|
|
@@ -115,7 +119,15 @@
|
|
d1 = 5.0D;
|
|
}
|
|
|
|
- this.level.explode(this, damagesource, (ExplosionDamageCalculator) null, this.getX(), this.getY(), this.getZ(), (float) (4.0D + this.random.nextDouble() * 1.5D * d1), false, World.a.TNT);
|
|
+ // CraftBukkit start
|
|
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), (float) (4.0D + this.random.nextDouble() * 1.5D * d1), false);
|
|
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
|
+ if (event.isCancelled()) {
|
|
+ fuse = -1;
|
|
+ return;
|
|
+ }
|
|
+ this.level.explode(this, damagesource, (ExplosionDamageCalculator) null, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), World.a.TNT);
|
|
+ // CraftBukkit end
|
|
this.discard();
|
|
}
|
|
|