mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 09:26:08 +03:00
63 lines
2.3 KiB
Diff
63 lines
2.3 KiB
Diff
--- ../src-base/minecraft/net/minecraft/entity/item/EntityTNTPrimed.java
|
|
+++ ../src-work/minecraft/net/minecraft/entity/item/EntityTNTPrimed.java
|
|
@@ -8,12 +8,15 @@
|
|
import net.minecraft.network.datasync.EntityDataManager;
|
|
import net.minecraft.util.EnumParticleTypes;
|
|
import net.minecraft.world.World;
|
|
+import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
|
|
|
|
public class EntityTNTPrimed extends Entity
|
|
{
|
|
private static final DataParameter<Integer> FUSE = EntityDataManager.<Integer>createKey(EntityTNTPrimed.class, DataSerializers.VARINT);
|
|
private EntityLivingBase tntPlacedBy;
|
|
private int fuse;
|
|
+ public float yield = 4; // CraftBukkit - add field
|
|
+ public boolean isIncendiary = false; // CraftBukkit - add field
|
|
|
|
public EntityTNTPrimed(World worldIn)
|
|
{
|
|
@@ -55,6 +58,7 @@
|
|
|
|
public void onUpdate()
|
|
{
|
|
+ if (worldObj.spigotConfig.currentPrimedTnt++ > worldObj.spigotConfig.maxTntTicksPerTick) { return; } // Spigot
|
|
this.prevPosX = this.posX;
|
|
this.prevPosY = this.posY;
|
|
this.prevPosZ = this.posZ;
|
|
@@ -80,12 +84,14 @@
|
|
|
|
if (this.fuse <= 0)
|
|
{
|
|
- this.setDead();
|
|
-
|
|
+ // CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event
|
|
+ //this.setDead();
|
|
if (!this.worldObj.isRemote)
|
|
{
|
|
this.explode();
|
|
}
|
|
+ this.setDead();
|
|
+ // CraftBukkit end
|
|
}
|
|
else
|
|
{
|
|
@@ -96,8 +102,16 @@
|
|
|
|
private void explode()
|
|
{
|
|
- float f = 4.0F;
|
|
- this.worldObj.createExplosion(this, this.posX, this.posY + (double)(this.height / 16.0F), this.posZ, 4.0F, true);
|
|
+ // CraftBukkit start
|
|
+ org.bukkit.craftbukkit.CraftServer server = this.worldObj.getServer();
|
|
+
|
|
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.entity.CraftEntity.getEntity(server, this));
|
|
+ server.getPluginManager().callEvent(event);
|
|
+
|
|
+ if (!event.isCancelled()) {
|
|
+ this.worldObj.newExplosion(this, this.posX, this.posY + (double) (this.height / 16.0F), this.posZ, event.getRadius(), event.getFire(), true);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
protected void writeEntityToNBT(NBTTagCompound compound)
|