2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/entity/item/EntityTNTPrimed.java
|
|
|
|
+++ b/net/minecraft/world/entity/item/EntityTNTPrimed.java
|
2023-06-24 09:15:05 +02:00
|
|
|
@@ -15,12 +15,19 @@
|
2023-03-14 17:30:00 +01:00
|
|
|
import net.minecraft.world.entity.TraceableEntity;
|
2021-03-15 23:00:00 +01:00
|
|
|
import net.minecraft.world.level.World;
|
2016-11-17 02:41:03 +01:00
|
|
|
|
2023-06-24 09:15:05 +02:00
|
|
|
+// CraftBukkit start;
|
|
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
|
|
+import org.bukkit.event.entity.ExplosionPrimeEvent;
|
|
|
|
+// CraftBukkit end
|
2021-03-08 22:47:33 +01:00
|
|
|
+
|
2023-03-14 17:30:00 +01:00
|
|
|
public class EntityTNTPrimed extends Entity implements TraceableEntity {
|
2014-11-25 22:32:16 +01:00
|
|
|
|
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);
|
2023-06-24 09:15:05 +02:00
|
|
|
@@ -71,10 +78,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();
|
2023-06-07 17:30: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();
|
2023-06-07 17:30:00 +02:00
|
|
|
if (this.level().isClientSide) {
|
2023-06-24 09:15:05 +02:00
|
|
|
@@ -85,9 +95,14 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private void explode() {
|
|
|
|
- float f = 4.0F;
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ // float f = 4.0F;
|
2023-06-24 09:15:05 +02:00
|
|
|
+ ExplosionPrimeEvent event = CraftEventFactory.callExplosionPrimeEvent((org.bukkit.entity.Explosive)this.getBukkitEntity());
|
2015-02-26 23:41:06 +01:00
|
|
|
|
2023-06-07 17:30:00 +02:00
|
|
|
- this.level().explode(this, this.getX(), this.getY(0.0625D), this.getZ(), 4.0F, World.a.TNT);
|
2014-11-25 22:32:16 +01:00
|
|
|
+ if (!event.isCancelled()) {
|
2023-06-07 17:30:00 +02:00
|
|
|
+ this.level().explode(this, this.getX(), this.getY(0.0625D), this.getZ(), event.getRadius(), event.getFire(), World.a.TNT);
|
2014-11-25 22:32:16 +01:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
@Override
|