2011-11-26 01:56:11 +01:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
|
|
|
public class EntityBlaze extends EntityMonster {
|
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
private float bp = 0.5F;
|
|
|
|
private int bq;
|
|
|
|
private int br;
|
2011-11-26 01:56:11 +01:00
|
|
|
|
|
|
|
public EntityBlaze(World world) {
|
|
|
|
super(world);
|
|
|
|
this.fireProof = true;
|
2013-07-01 13:03:00 +02:00
|
|
|
this.b = 10;
|
2011-11-26 01:56:11 +01:00
|
|
|
}
|
|
|
|
|
2013-09-19 20:25:08 +02:00
|
|
|
protected void az() {
|
|
|
|
super.az();
|
2013-07-09 01:43:37 +02:00
|
|
|
this.getAttributeInstance(GenericAttributes.e).setValue(6.0D);
|
2011-11-26 01:56:11 +01:00
|
|
|
}
|
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
protected void a() {
|
|
|
|
super.a();
|
2011-11-26 01:56:11 +01:00
|
|
|
this.datawatcher.a(16, new Byte((byte) 0));
|
|
|
|
}
|
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
protected String r() {
|
2011-11-26 01:56:11 +01:00
|
|
|
return "mob.blaze.breathe";
|
|
|
|
}
|
|
|
|
|
2013-09-19 20:25:08 +02:00
|
|
|
protected String aO() {
|
2011-11-26 01:56:11 +01:00
|
|
|
return "mob.blaze.hit";
|
|
|
|
}
|
|
|
|
|
2013-09-19 20:25:08 +02:00
|
|
|
protected String aP() {
|
2011-11-26 01:56:11 +01:00
|
|
|
return "mob.blaze.death";
|
|
|
|
}
|
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
public float d(float f) {
|
2011-11-26 01:56:11 +01:00
|
|
|
return 1.0F;
|
|
|
|
}
|
|
|
|
|
2012-10-25 05:53:23 +02:00
|
|
|
public void c() {
|
2011-11-26 01:56:11 +01:00
|
|
|
if (!this.world.isStatic) {
|
2013-09-19 20:25:08 +02:00
|
|
|
if (this.G()) {
|
2013-07-01 13:03:00 +02:00
|
|
|
this.damageEntity(DamageSource.DROWN, 1.0F);
|
2011-11-26 01:56:11 +01:00
|
|
|
}
|
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
--this.bq;
|
|
|
|
if (this.bq <= 0) {
|
|
|
|
this.bq = 100;
|
|
|
|
this.bp = 0.5F + (float) this.random.nextGaussian() * 3.0F;
|
2011-11-26 01:56:11 +01:00
|
|
|
}
|
|
|
|
|
2013-07-09 01:43:37 +02:00
|
|
|
if (this.bN() != null && this.bN().locY + (double) this.bN().getHeadHeight() > this.locY + (double) this.getHeadHeight() + (double) this.bp) {
|
2011-11-26 01:56:11 +01:00
|
|
|
this.motY += (0.30000001192092896D - this.motY) * 0.30000001192092896D;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.random.nextInt(24) == 0) {
|
|
|
|
this.world.makeSound(this.locX + 0.5D, this.locY + 0.5D, this.locZ + 0.5D, "fire.fire", 1.0F + this.random.nextFloat(), this.random.nextFloat() * 0.7F + 0.3F);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!this.onGround && this.motY < 0.0D) {
|
|
|
|
this.motY *= 0.6D;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < 2; ++i) {
|
2012-10-25 05:53:23 +02:00
|
|
|
this.world.addParticle("largesmoke", this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, 0.0D, 0.0D, 0.0D);
|
2011-11-26 01:56:11 +01:00
|
|
|
}
|
|
|
|
|
2012-10-25 05:53:23 +02:00
|
|
|
super.c();
|
2011-11-26 01:56:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
protected void a(Entity entity, float f) {
|
|
|
|
if (this.attackTicks <= 0 && f < 2.0F && entity.boundingBox.e > this.boundingBox.b && entity.boundingBox.b < this.boundingBox.e) {
|
|
|
|
this.attackTicks = 20;
|
2012-11-06 13:05:28 +01:00
|
|
|
this.m(entity);
|
2011-11-26 01:56:11 +01:00
|
|
|
} else if (f < 30.0F) {
|
|
|
|
double d0 = entity.locX - this.locX;
|
2011-11-30 00:17:43 +01:00
|
|
|
double d1 = entity.boundingBox.b + (double) (entity.length / 2.0F) - (this.locY + (double) (this.length / 2.0F));
|
2011-11-26 01:56:11 +01:00
|
|
|
double d2 = entity.locZ - this.locZ;
|
|
|
|
|
|
|
|
if (this.attackTicks == 0) {
|
2013-07-01 13:03:00 +02:00
|
|
|
++this.br;
|
|
|
|
if (this.br == 1) {
|
2011-11-26 01:56:11 +01:00
|
|
|
this.attackTicks = 60;
|
2013-03-13 23:33:27 +01:00
|
|
|
this.a(true);
|
2013-07-01 13:03:00 +02:00
|
|
|
} else if (this.br <= 4) {
|
2011-11-26 01:56:11 +01:00
|
|
|
this.attackTicks = 6;
|
|
|
|
} else {
|
|
|
|
this.attackTicks = 100;
|
2013-07-01 13:03:00 +02:00
|
|
|
this.br = 0;
|
2013-03-13 23:33:27 +01:00
|
|
|
this.a(false);
|
2011-11-26 01:56:11 +01:00
|
|
|
}
|
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
if (this.br > 1) {
|
2011-11-26 01:56:11 +01:00
|
|
|
float f1 = MathHelper.c(f) * 0.5F;
|
|
|
|
|
|
|
|
this.world.a((EntityHuman) null, 1009, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
|
|
|
|
|
|
|
|
for (int i = 0; i < 1; ++i) {
|
|
|
|
EntitySmallFireball entitysmallfireball = new EntitySmallFireball(this.world, this, d0 + this.random.nextGaussian() * (double) f1, d1, d2 + this.random.nextGaussian() * (double) f1);
|
|
|
|
|
2011-11-30 00:17:43 +01:00
|
|
|
entitysmallfireball.locY = this.locY + (double) (this.length / 2.0F) + 0.5D;
|
2011-11-26 01:56:11 +01:00
|
|
|
this.world.addEntity(entitysmallfireball);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this.yaw = (float) (Math.atan2(d2, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
|
2013-07-01 13:03:00 +02:00
|
|
|
this.bn = true;
|
2011-11-26 01:56:11 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
protected void b(float f) {}
|
2011-11-26 01:56:11 +01:00
|
|
|
|
2012-01-14 21:03:48 +01:00
|
|
|
protected int getLootId() {
|
2011-11-26 01:56:11 +01:00
|
|
|
return Item.BLAZE_ROD.id;
|
|
|
|
}
|
|
|
|
|
2012-01-14 21:03:48 +01:00
|
|
|
public boolean isBurning() {
|
2013-07-09 01:43:37 +02:00
|
|
|
return this.bT();
|
2011-11-26 01:56:11 +01:00
|
|
|
}
|
|
|
|
|
2011-11-30 00:17:43 +01:00
|
|
|
protected void dropDeathLoot(boolean flag, int i) {
|
2011-11-26 01:56:11 +01:00
|
|
|
if (flag) {
|
|
|
|
// CraftBukkit start
|
2012-07-22 08:18:00 +02:00
|
|
|
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
|
2011-11-26 01:56:11 +01:00
|
|
|
int j = this.random.nextInt(2 + i);
|
|
|
|
|
|
|
|
if (j > 0) {
|
|
|
|
loot.add(new org.bukkit.inventory.ItemStack(Item.BLAZE_ROD.id, j));
|
|
|
|
}
|
|
|
|
|
2012-07-22 08:18:00 +02:00
|
|
|
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, loot);
|
2011-11-26 01:56:11 +01:00
|
|
|
// CraftBukkit end
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-09 01:43:37 +02:00
|
|
|
public boolean bT() {
|
2011-11-26 01:56:11 +01:00
|
|
|
return (this.datawatcher.getByte(16) & 1) != 0;
|
|
|
|
}
|
|
|
|
|
2013-03-13 23:33:27 +01:00
|
|
|
public void a(boolean flag) {
|
2011-11-26 01:56:11 +01:00
|
|
|
byte b0 = this.datawatcher.getByte(16);
|
|
|
|
|
|
|
|
if (flag) {
|
|
|
|
b0 = (byte) (b0 | 1);
|
|
|
|
} else {
|
|
|
|
b0 &= -2;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.datawatcher.watch(16, Byte.valueOf(b0));
|
|
|
|
}
|
|
|
|
|
2012-10-25 05:53:23 +02:00
|
|
|
protected boolean i_() {
|
2011-11-26 01:56:11 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|