2011-09-21 02:40:22 +02:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
|
|
|
public class EntityChicken extends EntityAnimal {
|
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
public boolean d = false;
|
|
|
|
public float e = 0.0F;
|
|
|
|
public float f = 0.0F;
|
2011-09-21 02:40:22 +02:00
|
|
|
public float g;
|
|
|
|
public float h;
|
|
|
|
public float i = 1.0F;
|
|
|
|
public int j;
|
|
|
|
|
|
|
|
public EntityChicken(World world) {
|
|
|
|
super(world);
|
|
|
|
this.texture = "/mob/chicken.png";
|
2012-07-29 09:33:13 +02:00
|
|
|
this.a(0.3F, 0.7F);
|
2011-09-21 02:40:22 +02:00
|
|
|
this.j = this.random.nextInt(6000) + 6000;
|
2012-03-01 11:49:23 +01:00
|
|
|
float f = 0.25F;
|
|
|
|
|
|
|
|
this.goalSelector.a(0, new PathfinderGoalFloat(this));
|
|
|
|
this.goalSelector.a(1, new PathfinderGoalPanic(this, 0.38F));
|
|
|
|
this.goalSelector.a(2, new PathfinderGoalBreed(this, f));
|
2012-10-25 05:53:23 +02:00
|
|
|
this.goalSelector.a(3, new PathfinderGoalTempt(this, 0.25F, Item.SEEDS.id, false));
|
2012-03-01 11:49:23 +01:00
|
|
|
this.goalSelector.a(4, new PathfinderGoalFollowParent(this, 0.28F));
|
|
|
|
this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, f));
|
|
|
|
this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
|
|
|
|
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
|
|
|
|
}
|
|
|
|
|
2013-03-13 23:33:27 +01:00
|
|
|
public boolean bh() {
|
2012-03-01 11:49:23 +01:00
|
|
|
return true;
|
2011-09-21 02:40:22 +02:00
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public int getMaxHealth() {
|
|
|
|
return 4;
|
|
|
|
}
|
|
|
|
|
2012-10-25 05:53:23 +02:00
|
|
|
public void c() {
|
|
|
|
super.c();
|
2012-07-29 09:33:13 +02:00
|
|
|
this.h = this.e;
|
|
|
|
this.g = this.f;
|
|
|
|
this.f = (float) ((double) this.f + (double) (this.onGround ? -1 : 4) * 0.3D);
|
|
|
|
if (this.f < 0.0F) {
|
|
|
|
this.f = 0.0F;
|
2011-09-21 02:40:22 +02:00
|
|
|
}
|
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
if (this.f > 1.0F) {
|
|
|
|
this.f = 1.0F;
|
2011-09-21 02:40:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!this.onGround && this.i < 1.0F) {
|
|
|
|
this.i = 1.0F;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.i = (float) ((double) this.i * 0.9D);
|
|
|
|
if (!this.onGround && this.motY < 0.0D) {
|
|
|
|
this.motY *= 0.6D;
|
|
|
|
}
|
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
this.e += this.i * 2.0F;
|
2012-01-14 21:03:48 +01:00
|
|
|
if (!this.isBaby() && !this.world.isStatic && --this.j <= 0) {
|
2012-11-06 13:05:28 +01:00
|
|
|
this.makeSound("mob.chicken.plop", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
2011-09-21 02:40:22 +02:00
|
|
|
this.b(Item.EGG.id, 1);
|
|
|
|
this.j = this.random.nextInt(6000) + 6000;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-01 11:49:23 +01:00
|
|
|
protected void a(float f) {}
|
2011-09-21 02:40:22 +02:00
|
|
|
|
2013-03-13 23:33:27 +01:00
|
|
|
protected String bb() {
|
2012-10-25 05:53:23 +02:00
|
|
|
return "mob.chicken.say";
|
2011-09-21 02:40:22 +02:00
|
|
|
}
|
|
|
|
|
2013-03-13 23:33:27 +01:00
|
|
|
protected String bc() {
|
2012-10-25 05:53:23 +02:00
|
|
|
return "mob.chicken.hurt";
|
2011-09-21 02:40:22 +02:00
|
|
|
}
|
|
|
|
|
2013-03-13 23:33:27 +01:00
|
|
|
protected String bd() {
|
2012-10-25 05:53:23 +02:00
|
|
|
return "mob.chicken.hurt";
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void a(int i, int j, int k, int l) {
|
2012-11-06 13:05:28 +01:00
|
|
|
this.makeSound("mob.chicken.step", 0.15F, 1.0F);
|
2011-09-21 02:40:22 +02:00
|
|
|
}
|
|
|
|
|
2012-01-14 21:03:48 +01:00
|
|
|
protected int getLootId() {
|
2011-09-21 02:40:22 +02:00
|
|
|
return Item.FEATHER.id;
|
|
|
|
}
|
|
|
|
|
2011-11-30 00:17:43 +01:00
|
|
|
protected void dropDeathLoot(boolean flag, int i) {
|
2013-03-25 05:22:32 +01:00
|
|
|
// CraftBukkit start - Whole method
|
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-20 09:01:14 +01:00
|
|
|
int j = this.random.nextInt(3) + this.random.nextInt(1 + i);
|
|
|
|
|
|
|
|
if (j > 0) {
|
|
|
|
loot.add(new org.bukkit.inventory.ItemStack(Item.FEATHER.id, j));
|
|
|
|
}
|
2011-09-21 02:40:22 +02:00
|
|
|
|
2012-01-14 21:03:48 +01:00
|
|
|
if (this.isBurning()) {
|
2011-11-26 01:56:11 +01:00
|
|
|
loot.add(new org.bukkit.inventory.ItemStack(Item.COOKED_CHICKEN.id, 1));
|
2011-11-20 09:01:14 +01:00
|
|
|
} else {
|
2011-11-26 01:56:11 +01:00
|
|
|
loot.add(new org.bukkit.inventory.ItemStack(Item.RAW_CHICKEN.id, 1));
|
2011-09-21 02:40:22 +02:00
|
|
|
}
|
|
|
|
|
2012-07-22 08:18:00 +02:00
|
|
|
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, loot);
|
2011-09-21 02:40:22 +02:00
|
|
|
// CraftBukkit end
|
|
|
|
}
|
2011-11-20 09:01:14 +01:00
|
|
|
|
2012-11-06 13:05:28 +01:00
|
|
|
public EntityChicken b(EntityAgeable entityageable) {
|
2011-11-20 09:01:14 +01:00
|
|
|
return new EntityChicken(this.world);
|
|
|
|
}
|
2012-10-25 05:53:23 +02:00
|
|
|
|
|
|
|
public boolean c(ItemStack itemstack) {
|
|
|
|
return itemstack != null && itemstack.getItem() instanceof ItemSeeds;
|
|
|
|
}
|
2012-11-06 13:05:28 +01:00
|
|
|
|
|
|
|
public EntityAgeable createChild(EntityAgeable entityageable) {
|
|
|
|
return this.b(entityageable);
|
|
|
|
}
|
2011-09-21 02:40:22 +02:00
|
|
|
}
|