Files
2019-02-24 22:29:41 +08:00

61 lines
2.9 KiB
Diff

--- ../src-base/minecraft/net/minecraft/entity/projectile/EntityWitherSkull.java
+++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityWitherSkull.java
@@ -3,7 +3,6 @@
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.boss.EntityWither;
import net.minecraft.init.MobEffects;
import net.minecraft.network.datasync.DataParameter;
import net.minecraft.network.datasync.DataSerializers;
@@ -18,6 +17,7 @@
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
+import org.bukkit.event.entity.ExplosionPrimeEvent;
public class EntityWitherSkull extends EntityFireball
{
@@ -62,7 +62,7 @@
float f = super.getExplosionResistance(explosionIn, worldIn, pos, blockStateIn);
Block block = blockStateIn.getBlock();
- if (this.isInvulnerable() && EntityWither.canDestroyBlock(block))
+ if (this.isInvulnerable() && block.canEntityDestroy(blockStateIn, worldIn, pos, this) && net.minecraftforge.event.ForgeEventFactory.onEntityDestroyBlock(this.shootingEntity, pos, blockStateIn))
{
f = Math.min(0.8F, f);
}
@@ -78,7 +78,7 @@
{
if (this.shootingEntity != null)
{
- if (result.entityHit.attackEntityFrom(DamageSource.causeMobDamage(this.shootingEntity), 8.0F))
+ if (result.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.shootingEntity), 8.0F))
{
if (result.entityHit.isEntityAlive())
{
@@ -86,7 +86,7 @@
}
else
{
- this.shootingEntity.heal(5.0F);
+ this.shootingEntity.heal(5.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.WITHER);
}
}
}
@@ -115,7 +115,13 @@
}
}
- this.world.newExplosion(this, this.posX, this.posY, this.posZ, 1.0F, false, this.world.getGameRules().getBoolean("mobGriefing"));
+ // this.world.newExplosion(this, this.posX, this.posY, this.posZ, 1.0F, false, net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.world, this.shootingEntity));
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 1.0F, false);
+ this.world.getServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ this.world.newExplosion(this, this.posX, this.posY, this.posZ, event.getRadius(), event.getFire(), net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.world, this.shootingEntity));
+ }
this.setDead();
}
}