mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-10 03:52:45 +01:00
8b26bb8f3e
By: md_5 <git@md-5.net>
53 lines
2 KiB
Diff
53 lines
2 KiB
Diff
--- a/net/minecraft/world/entity/item/EntityTNTPrimed.java
|
|
+++ b/net/minecraft/world/entity/item/EntityTNTPrimed.java
|
|
@@ -14,12 +14,16 @@
|
|
import net.minecraft.world.entity.EnumMoveType;
|
|
import net.minecraft.world.level.World;
|
|
|
|
+import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
|
|
+
|
|
public class EntityTNTPrimed extends Entity {
|
|
|
|
private static final DataWatcherObject<Integer> DATA_FUSE_ID = DataWatcher.defineId(EntityTNTPrimed.class, DataWatcherRegistry.INT);
|
|
private static final int DEFAULT_FUSE_TIME = 80;
|
|
@Nullable
|
|
public EntityLiving owner;
|
|
+ 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);
|
|
@@ -70,10 +74,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();
|
|
+ // CraftBukkit end
|
|
} else {
|
|
this.updateInWaterStateAndDoFluidPushing();
|
|
if (this.level.isClientSide) {
|
|
@@ -84,9 +91,16 @@
|
|
}
|
|
|
|
private void explode() {
|
|
- float f = 4.0F;
|
|
+ // CraftBukkit start
|
|
+ // float f = 4.0F;
|
|
|
|
- this.level.explode(this, this.getX(), this.getY(0.0625D), this.getZ(), 4.0F, World.a.TNT);
|
|
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) this.getBukkitEntity());
|
|
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
|
+
|
|
+ if (!event.isCancelled()) {
|
|
+ this.level.explode(this, this.getX(), this.getY(0.0625D), this.getZ(), event.getRadius(), event.getFire(), World.a.TNT);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
@Override
|