2012-10-25 05:53:23 +02:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
2013-03-25 05:22:32 +01:00
|
|
|
import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
|
2012-10-25 05:53:23 +02:00
|
|
|
|
|
|
|
public class EntityWitherSkull extends EntityFireball {
|
|
|
|
|
|
|
|
public EntityWitherSkull(World world) {
|
|
|
|
super(world);
|
|
|
|
this.a(0.3125F, 0.3125F);
|
|
|
|
}
|
|
|
|
|
|
|
|
public EntityWitherSkull(World world, EntityLiving entityliving, double d0, double d1, double d2) {
|
|
|
|
super(world, entityliving, d0, d1, d2);
|
|
|
|
this.a(0.3125F, 0.3125F);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected float c() {
|
|
|
|
return this.d() ? 0.73F : super.c();
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isBurning() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-03-13 23:33:27 +01:00
|
|
|
public float a(Explosion explosion, World world, int i, int j, int k, Block block) {
|
|
|
|
float f = super.a(explosion, world, i, j, k, block);
|
2012-10-25 05:53:23 +02:00
|
|
|
|
2012-11-06 13:05:28 +01:00
|
|
|
if (this.d() && block != Block.BEDROCK && block != Block.ENDER_PORTAL && block != Block.ENDER_PORTAL_FRAME) {
|
2012-10-25 05:53:23 +02:00
|
|
|
f = Math.min(0.8F, f);
|
|
|
|
}
|
|
|
|
|
|
|
|
return f;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void a(MovingObjectPosition movingobjectposition) {
|
|
|
|
if (!this.world.isStatic) {
|
|
|
|
if (movingobjectposition.entity != null) {
|
|
|
|
if (this.shooter != null) {
|
|
|
|
if (movingobjectposition.entity.damageEntity(DamageSource.mobAttack(this.shooter), 8) && !movingobjectposition.entity.isAlive()) {
|
2013-03-25 05:22:32 +01:00
|
|
|
this.shooter.heal(5, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.WITHER); // CraftBukkit
|
2012-10-25 05:53:23 +02:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
movingobjectposition.entity.damageEntity(DamageSource.MAGIC, 5);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (movingobjectposition.entity instanceof EntityLiving) {
|
|
|
|
byte b0 = 0;
|
|
|
|
|
|
|
|
if (this.world.difficulty > 1) {
|
|
|
|
if (this.world.difficulty == 2) {
|
|
|
|
b0 = 10;
|
|
|
|
} else if (this.world.difficulty == 3) {
|
|
|
|
b0 = 40;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (b0 > 0) {
|
|
|
|
((EntityLiving) movingobjectposition.entity).addEffect(new MobEffect(MobEffectList.WITHER.id, 20 * b0, 1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// CraftBukkit start
|
|
|
|
ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 1.0F, false);
|
|
|
|
this.world.getServer().getPluginManager().callEvent(event);
|
|
|
|
|
|
|
|
if (!event.isCancelled()) {
|
|
|
|
this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), this.world.getGameRules().getBoolean("mobGriefing"));
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
|
|
|
|
this.die();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-13 23:33:27 +01:00
|
|
|
public boolean K() {
|
2012-10-25 05:53:23 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean damageEntity(DamageSource damagesource, int i) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void a() {
|
|
|
|
this.datawatcher.a(10, Byte.valueOf((byte) 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean d() {
|
|
|
|
return this.datawatcher.getByte(10) == 1;
|
|
|
|
}
|
|
|
|
|
2013-03-13 23:33:27 +01:00
|
|
|
public void a(boolean flag) {
|
2012-10-25 05:53:23 +02:00
|
|
|
this.datawatcher.watch(10, Byte.valueOf((byte) (flag ? 1 : 0)));
|
|
|
|
}
|
|
|
|
}
|