mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 11:44:19 +01:00
eed041d629
By: md_5 <git@md-5.net>
56 lines
2.5 KiB
Diff
56 lines
2.5 KiB
Diff
--- a/net/minecraft/world/entity/item/EntityTNTPrimed.java
|
|
+++ b/net/minecraft/world/entity/item/EntityTNTPrimed.java
|
|
@@ -24,6 +24,12 @@
|
|
import net.minecraft.world.level.material.Fluid;
|
|
import net.minecraft.world.level.portal.DimensionTransition;
|
|
|
|
+// CraftBukkit start;
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
+import org.bukkit.event.entity.EntityRemoveEvent;
|
|
+import org.bukkit.event.entity.ExplosionPrimeEvent;
|
|
+// CraftBukkit end
|
|
+
|
|
public class EntityTNTPrimed extends Entity implements TraceableEntity {
|
|
|
|
private static final DataWatcherObject<Integer> DATA_FUSE_ID = DataWatcher.defineId(EntityTNTPrimed.class, DataWatcherRegistry.INT);
|
|
@@ -45,6 +51,8 @@
|
|
@Nullable
|
|
public EntityLiving owner;
|
|
private boolean usedPortal;
|
|
+ public float yield = 4; // CraftBukkit - add field
|
|
+ public boolean isIncendiary = false; // CraftBukkit - add field
|
|
|
|
public EntityTNTPrimed(EntityTypes<? extends EntityTNTPrimed> entitytypes, World world) {
|
|
super(entitytypes, world);
|
|
@@ -99,10 +107,13 @@
|
|
|
|
this.setFuse(i);
|
|
if (i <= 0) {
|
|
- this.discard();
|
|
+ // CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event
|
|
+ // this.discard();
|
|
if (!this.level().isClientSide) {
|
|
this.explode();
|
|
}
|
|
+ this.discard(EntityRemoveEvent.Cause.EXPLODE); // CraftBukkit - add Bukkit remove cause
|
|
+ // CraftBukkit end
|
|
} else {
|
|
this.updateInWaterStateAndDoFluidPushing();
|
|
if (this.level().isClientSide) {
|
|
@@ -113,9 +124,14 @@
|
|
}
|
|
|
|
private void explode() {
|
|
- float f = 4.0F;
|
|
+ // CraftBukkit start
|
|
+ // float f = 4.0F;
|
|
+ ExplosionPrimeEvent event = CraftEventFactory.callExplosionPrimeEvent((org.bukkit.entity.Explosive)this.getBukkitEntity());
|
|
|
|
- this.level().explode(this, Explosion.getDefaultDamageSource(this.level(), this), this.usedPortal ? EntityTNTPrimed.USED_PORTAL_DAMAGE_CALCULATOR : null, this.getX(), this.getY(0.0625D), this.getZ(), 4.0F, false, World.a.TNT);
|
|
+ if (!event.isCancelled()) {
|
|
+ this.level().explode(this, Explosion.getDefaultDamageSource(this.level(), this), this.usedPortal ? EntityTNTPrimed.USED_PORTAL_DAMAGE_CALCULATOR : null, this.getX(), this.getY(0.0625D), this.getZ(), event.getRadius(), event.getFire(), World.a.TNT);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
@Override
|