2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/entity/item/EntityTNTPrimed.java
|
|
|
|
+++ b/net/minecraft/world/entity/item/EntityTNTPrimed.java
|
|
|
|
@@ -17,12 +17,16 @@
|
|
|
|
import net.minecraft.world.level.Explosion;
|
|
|
|
import net.minecraft.world.level.World;
|
2016-11-17 02:41:03 +01:00
|
|
|
|
2021-03-08 22:47:33 +01:00
|
|
|
+import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
|
|
|
|
+
|
2014-11-25 22:32:16 +01:00
|
|
|
public class EntityTNTPrimed extends Entity {
|
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
private static final DataWatcherObject<Integer> DATA_FUSE_ID = DataWatcher.defineId(EntityTNTPrimed.class, DataWatcherRegistry.INT);
|
2021-06-11 07:00:00 +02:00
|
|
|
private static final int DEFAULT_FUSE_TIME = 80;
|
2016-11-17 02:41:03 +01:00
|
|
|
@Nullable
|
2021-06-11 07:00:00 +02:00
|
|
|
public EntityLiving owner;
|
2014-11-25 22:32:16 +01:00
|
|
|
+ public float yield = 4; // CraftBukkit - add field
|
|
|
|
+ public boolean isIncendiary = false; // CraftBukkit - add field
|
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
public EntityTNTPrimed(EntityTypes<? extends EntityTNTPrimed> entitytypes, World world) {
|
|
|
|
super(entitytypes, world);
|
2021-06-11 07:00:00 +02:00
|
|
|
@@ -73,10 +77,13 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
this.setFuse(i);
|
2021-06-11 07:00:00 +02:00
|
|
|
if (i <= 0) {
|
2021-11-21 23:00:00 +01:00
|
|
|
- this.discard();
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event
|
2021-11-21 23:00:00 +01:00
|
|
|
+ // this.discard();
|
2021-06-11 07:00:00 +02:00
|
|
|
if (!this.level.isClientSide) {
|
2014-11-25 22:32:16 +01:00
|
|
|
this.explode();
|
|
|
|
}
|
2021-11-21 23:00:00 +01:00
|
|
|
+ this.discard();
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit end
|
|
|
|
} else {
|
2021-11-21 23:00:00 +01:00
|
|
|
this.updateInWaterStateAndDoFluidPushing();
|
2021-06-11 07:00:00 +02:00
|
|
|
if (this.level.isClientSide) {
|
|
|
|
@@ -87,9 +94,16 @@
|
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
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
- this.level.explode(this, this.getX(), this.getY(0.0625D), this.getZ(), 4.0F, Explosion.Effect.BREAK);
|
2019-03-04 16:12:52 +01:00
|
|
|
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) this.getBukkitEntity());
|
2021-06-11 13:33:49 +02:00
|
|
|
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
2014-11-25 22:32:16 +01:00
|
|
|
+
|
|
|
|
+ if (!event.isCancelled()) {
|
2021-11-21 23:00:00 +01:00
|
|
|
+ this.level.explode(this, this.getX(), this.getY(0.0625D), this.getZ(), event.getRadius(), event.getFire(), Explosion.Effect.BREAK);
|
2014-11-25 22:32:16 +01:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
@Override
|