From 6c09066e224ac85b8a6464eaf8f53edfeb4beda4 Mon Sep 17 00:00:00 2001 From: Nate Mortensen Date: Mon, 1 Jul 2013 06:03:00 -0500 Subject: Update CraftBukkit to 1.6.1 --- .../java/net/minecraft/server/EntityAgeable.java | 69 +++++++++++++--------- 1 file changed, 42 insertions(+), 27 deletions(-) (limited to 'src/main/java/net/minecraft/server/EntityAgeable.java') diff --git a/src/main/java/net/minecraft/server/EntityAgeable.java b/src/main/java/net/minecraft/server/EntityAgeable.java index fdc9167a..5ba19f3c 100644 --- a/src/main/java/net/minecraft/server/EntityAgeable.java +++ b/src/main/java/net/minecraft/server/EntityAgeable.java @@ -2,8 +2,8 @@ package net.minecraft.server; public abstract class EntityAgeable extends EntityCreature { - private float d = -1.0F; - private float e; + private float bp = -1.0F; + private float bq; public boolean ageLocked = false; // CraftBukkit public EntityAgeable(World world) { @@ -12,34 +12,38 @@ public abstract class EntityAgeable extends EntityCreature { public abstract EntityAgeable createChild(EntityAgeable entityageable); - public boolean a_(EntityHuman entityhuman) { + public boolean a(EntityHuman entityhuman) { ItemStack itemstack = entityhuman.inventory.getItemInHand(); - if (itemstack != null && itemstack.id == Item.MONSTER_EGG.id && !this.world.isStatic) { - Class oclass = EntityTypes.a(itemstack.getData()); + if (itemstack != null && itemstack.id == Item.MONSTER_EGG.id) { + if (!this.world.isStatic) { + Class oclass = EntityTypes.a(itemstack.getData()); - if (oclass != null && oclass.isAssignableFrom(this.getClass())) { - EntityAgeable entityageable = this.createChild(this); + if (oclass != null && oclass.isAssignableFrom(this.getClass())) { + EntityAgeable entityageable = this.createChild(this); - if (entityageable != null) { - entityageable.setAge(-24000); - entityageable.setPositionRotation(this.locX, this.locY, this.locZ, 0.0F, 0.0F); - this.world.addEntity(entityageable, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // CraftBukkit - if (itemstack.hasName()) { - entityageable.setCustomName(itemstack.getName()); - } + if (entityageable != null) { + entityageable.setAge(-24000); + entityageable.setPositionRotation(this.locX, this.locY, this.locZ, 0.0F, 0.0F); + this.world.addEntity(entityageable, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // CraftBukkit + if (itemstack.hasName()) { + entityageable.setCustomName(itemstack.getName()); + } - if (!entityhuman.abilities.canInstantlyBuild) { - --itemstack.count; - if (itemstack.count == 0) { // CraftBukkit - allow less than 0 stacks as "infinite" - entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null); + if (!entityhuman.abilities.canInstantlyBuild) { + --itemstack.count; + if (itemstack.count == 0) { // CraftBukkit - allow less than 0 stacks as "infinite" + entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null); + } } } } } - } - return super.a_(entityhuman); + return true; + } else { + return false; + } } protected void a() { @@ -51,6 +55,17 @@ public abstract class EntityAgeable extends EntityCreature { return this.datawatcher.getInt(12); } + public void a(int i) { + int j = this.getAge(); + + j += i * 20; + if (j > 0) { + j = 0; + } + + this.setAge(j); + } + public void setAge(int i) { this.datawatcher.watch(12, Integer.valueOf(i)); this.a(this.isBaby()); @@ -90,20 +105,20 @@ public abstract class EntityAgeable extends EntityCreature { } public void a(boolean flag) { - this.j(flag ? 0.5F : 1.0F); + this.a(flag ? 0.5F : 1.0F); } protected final void a(float f, float f1) { - boolean flag = this.d > 0.0F; + boolean flag = this.bp > 0.0F; - this.d = f; - this.e = f1; + this.bp = f; + this.bq = f1; if (!flag) { - this.j(1.0F); + this.a(1.0F); } } - private void j(float f) { - super.a(this.d * f, this.e * f); + protected final void a(float f) { + super.a(this.bp * f, this.bq * f); } } -- cgit v1.2.3