Files
CatServer/patches/net/minecraft/entity/projectile/EntityWitherSkull.java.patch

60 lines
2.5 KiB
Diff

--- ../src-base/minecraft/net/minecraft/entity/projectile/EntityWitherSkull.java
+++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityWitherSkull.java
@@ -1,5 +1,7 @@
package net.minecraft.entity.projectile;
+import org.bukkit.event.entity.ExplosionPrimeEvent;
+
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
@@ -76,9 +78,11 @@
{
if (result.entityHit != null)
{
+ boolean didDamage = false; // Spigot
if (this.shootingEntity != null)
{
- if (result.entityHit.attackEntityFrom(DamageSource.causeMobDamage(this.shootingEntity), 8.0F))
+ didDamage = result.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.shootingEntity), 8.0F); // CraftBukkit
+ if (didDamage)
{
if (result.entityHit.isEntityAlive())
{
@@ -86,16 +90,16 @@
}
else
{
- this.shootingEntity.heal(5.0F);
+ this.shootingEntity.heal(5.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.WITHER); // CraftBukkit
}
}
}
else
{
- result.entityHit.attackEntityFrom(DamageSource.magic, 5.0F);
+ didDamage = result.entityHit.attackEntityFrom(DamageSource.magic, 5.0F);
}
- if (result.entityHit instanceof EntityLivingBase)
+ if (didDamage && result.entityHit instanceof EntityLivingBase)
{
int i = 0;
@@ -115,7 +119,14 @@
}
}
- this.worldObj.newExplosion(this, this.posX, this.posY, this.posZ, 1.0F, false, this.worldObj.getGameRules().getBoolean("mobGriefing"));
+ // CraftBukkit start
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 1.0F, false);
+ this.worldObj.getServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ this.worldObj.newExplosion(this, this.posX, this.posY, this.posZ, event.getRadius(), event.getFire(), this.worldObj.getGameRules().getBoolean("mobGriefing"));
+ }
+ // CraftBukkit end
this.setDead();
}
}