summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/EntityChicken.java
diff options
context:
space:
mode:
authorEvilSeph <evilseph@gmail.com>2011-09-20 20:40:22 -0400
committerEvilSeph <evilseph@gmail.com>2011-09-20 23:44:44 -0400
commit3f04f04be64f1724b1952e3b874697a104ec9094 (patch)
tree21259caa09e030dac37cb302de6f58ae76df426c /src/main/java/net/minecraft/server/EntityChicken.java
parent0a52c7f3346833fd568e020d3f1b918b792b09f4 (diff)
downloadcraftbukkit-3f04f04be64f1724b1952e3b874697a104ec9094.tar
craftbukkit-3f04f04be64f1724b1952e3b874697a104ec9094.tar.gz
craftbukkit-3f04f04be64f1724b1952e3b874697a104ec9094.tar.lz
craftbukkit-3f04f04be64f1724b1952e3b874697a104ec9094.tar.xz
craftbukkit-3f04f04be64f1724b1952e3b874697a104ec9094.zip
Added/updated EntityDeathEvents to reflect changes to the Vanilla spec.
Diffstat (limited to 'src/main/java/net/minecraft/server/EntityChicken.java')
-rw-r--r--src/main/java/net/minecraft/server/EntityChicken.java105
1 files changed, 105 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/EntityChicken.java b/src/main/java/net/minecraft/server/EntityChicken.java
new file mode 100644
index 00000000..e8797157
--- /dev/null
+++ b/src/main/java/net/minecraft/server/EntityChicken.java
@@ -0,0 +1,105 @@
+package net.minecraft.server;
+
+// CraftBukkit start
+import java.util.List;
+
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.entity.CraftEntity;
+import org.bukkit.event.entity.EntityDeathEvent;
+// CraftBukkit end
+
+public class EntityChicken extends EntityAnimal {
+
+ public boolean a = false;
+ public float b = 0.0F;
+ public float c = 0.0F;
+ 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";
+ this.b(0.3F, 0.7F);
+ this.health = 4;
+ this.j = this.random.nextInt(6000) + 6000;
+ }
+
+ public void s() {
+ super.s();
+ this.h = this.b;
+ this.g = this.c;
+ this.c = (float) ((double) this.c + (double) (this.onGround ? -1 : 4) * 0.3D);
+ if (this.c < 0.0F) {
+ this.c = 0.0F;
+ }
+
+ if (this.c > 1.0F) {
+ this.c = 1.0F;
+ }
+
+ 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;
+ }
+
+ this.b += this.i * 2.0F;
+ if (!this.world.isStatic && --this.j <= 0) {
+ this.world.makeSound(this, "mob.chickenplop", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
+ this.b(Item.EGG.id, 1);
+ this.j = this.random.nextInt(6000) + 6000;
+ }
+ }
+
+ protected void a(float f) {}
+
+ public void b(NBTTagCompound nbttagcompound) {
+ super.b(nbttagcompound);
+ }
+
+ public void a(NBTTagCompound nbttagcompound) {
+ super.a(nbttagcompound);
+ }
+
+ protected String h() {
+ return "mob.chicken";
+ }
+
+ protected String i() {
+ return "mob.chickenhurt";
+ }
+
+ protected String j() {
+ return "mob.chickenhurt";
+ }
+
+ protected int k() {
+ return Item.FEATHER.id;
+ }
+
+ protected void a(boolean flag) {
+ // CraftBukkit start - whole method
+ List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
+ int count = this.random.nextInt(3);
+
+ if (count > 0) {
+ loot.add(new org.bukkit.inventory.ItemStack(Item.FEATHER.id, count));
+ loot.add(new org.bukkit.inventory.ItemStack(this.fireTicks > 0 ? Item.COOKED_CHICKEN.id : Item.RAW_CHICKEN.id, 1));
+ }
+
+ CraftEntity entity = (CraftEntity) this.getBukkitEntity();
+ EntityDeathEvent event = new EntityDeathEvent(entity, loot);
+ org.bukkit.World bworld = this.world.getWorld();
+ this.world.getServer().getPluginManager().callEvent(event);
+
+ for (org.bukkit.inventory.ItemStack stack: event.getDrops()) {
+ bworld.dropItemNaturally(entity.getLocation(), stack);
+ }
+ // CraftBukkit end
+ }
+}