diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2013-03-13 17:33:27 -0500 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2013-03-15 13:28:59 -0500 |
commit | 83d29e461c85733f0113b6eb19db6e3b42da2949 (patch) | |
tree | b3063a1c28f478ab368d5ba3413a842def68c28f /src/main/java/net/minecraft/server/EntityAgeable.java | |
parent | ba6e4c38cfa98ad291974195cc46d70a4f138ac1 (diff) | |
download | craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.tar craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.tar.gz craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.tar.lz craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.tar.xz craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.zip |
Update CraftBukkit to Minecraft 1.5
Diffstat (limited to 'src/main/java/net/minecraft/server/EntityAgeable.java')
-rw-r--r-- | src/main/java/net/minecraft/server/EntityAgeable.java | 53 |
1 files changed, 41 insertions, 12 deletions
diff --git a/src/main/java/net/minecraft/server/EntityAgeable.java b/src/main/java/net/minecraft/server/EntityAgeable.java index 845a9023..fdc9167a 100644 --- a/src/main/java/net/minecraft/server/EntityAgeable.java +++ b/src/main/java/net/minecraft/server/EntityAgeable.java @@ -1,6 +1,9 @@ package net.minecraft.server; public abstract class EntityAgeable extends EntityCreature { + + private float d = -1.0F; + private float e; public boolean ageLocked = false; // CraftBukkit public EntityAgeable(World world) { @@ -9,7 +12,7 @@ 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) { @@ -22,9 +25,13 @@ public abstract class EntityAgeable extends EntityCreature { 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 "infinit" + if (itemstack.count == 0) { // CraftBukkit - allow less than 0 stacks as "infinite" entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null); } } @@ -32,7 +39,7 @@ public abstract class EntityAgeable extends EntityCreature { } } - return super.a(entityhuman); + return super.a_(entityhuman); } protected void a() { @@ -46,6 +53,7 @@ public abstract class EntityAgeable extends EntityCreature { public void setAge(int i) { this.datawatcher.watch(12, Integer.valueOf(i)); + this.a(this.isBaby()); } public void b(NBTTagCompound nbttagcompound) { @@ -62,19 +70,40 @@ public abstract class EntityAgeable extends EntityCreature { public void c() { super.c(); - int i = this.getAge(); - - if (ageLocked) return; // CraftBukkit - if (i < 0) { - ++i; - this.setAge(i); - } else if (i > 0) { - --i; - this.setAge(i); + if (this.world.isStatic || this.ageLocked) { // CraftBukkit + this.a(this.isBaby()); + } else { + int i = this.getAge(); + + if (i < 0) { + ++i; + this.setAge(i); + } else if (i > 0) { + --i; + this.setAge(i); + } } } public boolean isBaby() { return this.getAge() < 0; } + + public void a(boolean flag) { + this.j(flag ? 0.5F : 1.0F); + } + + protected final void a(float f, float f1) { + boolean flag = this.d > 0.0F; + + this.d = f; + this.e = f1; + if (!flag) { + this.j(1.0F); + } + } + + private void j(float f) { + super.a(this.d * f, this.e * f); + } } |