aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/item/PrimedTnt.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/item/PrimedTnt.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/item/PrimedTnt.java.patch57
1 files changed, 57 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/item/PrimedTnt.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/item/PrimedTnt.java.patch
new file mode 100644
index 0000000000..d4574d5308
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/item/PrimedTnt.java.patch
@@ -0,0 +1,57 @@
+--- a/net/minecraft/world/entity/item/PrimedTnt.java
++++ b/net/minecraft/world/entity/item/PrimedTnt.java
+@@ -19,6 +19,11 @@
+ import net.minecraft.world.level.block.Blocks;
+ import net.minecraft.world.level.block.state.BlockState;
+
++// CraftBukkit start;
++import org.bukkit.craftbukkit.event.CraftEventFactory;
++import org.bukkit.event.entity.ExplosionPrimeEvent;
++// CraftBukkit end
++
+ public class PrimedTnt extends Entity implements TraceableEntity {
+ private static final EntityDataAccessor<Integer> DATA_FUSE_ID = SynchedEntityData.defineId(PrimedTnt.class, EntityDataSerializers.INT);
+ private static final EntityDataAccessor<BlockState> DATA_BLOCK_STATE_ID = SynchedEntityData.defineId(PrimedTnt.class, EntityDataSerializers.BLOCK_STATE);
+@@ -26,7 +32,9 @@
+ private static final String TAG_BLOCK_STATE = "block_state";
+ public static final String TAG_FUSE = "fuse";
+ @Nullable
+- private LivingEntity owner;
++ public LivingEntity owner;
++ public float yield = 4; // CraftBukkit - add field
++ public boolean isIncendiary = false; // CraftBukkit - add field
+
+ public PrimedTnt(EntityType<? extends PrimedTnt> entityType, Level level) {
+ super(entityType, level);
+@@ -76,10 +86,13 @@
+ int i = this.getFuse() - 1;
+ 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) {
+@@ -89,8 +103,14 @@
+ }
+
+ private void explode() {
+- float f = 4.0F;
+- this.level().explode(this, this.getX(), this.getY(0.0625), this.getZ(), 4.0F, Level.ExplosionInteraction.TNT);
++ // CraftBukkit start
++ // float f = 4.0F;
++ ExplosionPrimeEvent event = CraftEventFactory.callExplosionPrimeEvent((org.bukkit.entity.Explosive)this.getBukkitEntity());
++
++ if (!event.isCancelled()) {
++ this.level().explode(this, this.getX(), this.getY(0.0625D), this.getZ(), event.getRadius(), event.getFire(), Level.a.TNT);
++ }
++ // CraftBukkit end
+ }
+
+ @Override