diff options
author | Erik Broes <erikbroes@grum.nl> | 2011-01-29 22:50:29 +0100 |
---|---|---|
committer | Erik Broes <erikbroes@grum.nl> | 2011-01-30 13:24:39 +0100 |
commit | df69047324abc54f5d5b8d069bb69b1061b20cce (patch) | |
tree | 76f8d13addf80730deea9285f4bd9a1ffbe45f80 /src/main/java/net/minecraft/server/EntitySheep.java | |
parent | d0cd8c6cc7d1aaf38934996e7e5d3e03272e4ff1 (diff) | |
download | craftbukkit-df69047324abc54f5d5b8d069bb69b1061b20cce.tar craftbukkit-df69047324abc54f5d5b8d069bb69b1061b20cce.tar.gz craftbukkit-df69047324abc54f5d5b8d069bb69b1061b20cce.tar.lz craftbukkit-df69047324abc54f5d5b8d069bb69b1061b20cce.tar.xz craftbukkit-df69047324abc54f5d5b8d069bb69b1061b20cce.zip |
Port to new mc-dev format.
Diffstat (limited to 'src/main/java/net/minecraft/server/EntitySheep.java')
-rw-r--r-- | src/main/java/net/minecraft/server/EntitySheep.java | 96 |
1 files changed, 29 insertions, 67 deletions
diff --git a/src/main/java/net/minecraft/server/EntitySheep.java b/src/main/java/net/minecraft/server/EntitySheep.java index 725624a9..987ed311 100644 --- a/src/main/java/net/minecraft/server/EntitySheep.java +++ b/src/main/java/net/minecraft/server/EntitySheep.java @@ -7,85 +7,53 @@ import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.entity.CraftSheep; // CraftBukkit end -public class EntitySheep extends EntityAnimals { - - public static final float a[][] = { - { - 1.0F, 1.0F, 1.0F - }, { - 0.95F, 0.7F, 0.2F - }, { - 0.9F, 0.5F, 0.85F - }, { - 0.6F, 0.7F, 0.95F - }, { - 0.9F, 0.9F, 0.2F - }, { - 0.5F, 0.8F, 0.1F - }, { - 0.95F, 0.7F, 0.8F - }, { - 0.3F, 0.3F, 0.3F - }, { - 0.6F, 0.6F, 0.6F - }, { - 0.3F, 0.6F, 0.7F - }, { - 0.7F, 0.4F, 0.9F - }, { - 0.2F, 0.4F, 0.8F - }, { - 0.5F, 0.4F, 0.3F - }, { - 0.4F, 0.5F, 0.2F - }, { - 0.8F, 0.3F, 0.3F - }, { - 0.1F, 0.1F, 0.1F - } - }; +public class EntitySheep extends EntityAnimal { + + public static final float[][] a = new float[][] { { 1.0F, 1.0F, 1.0F}, { 0.95F, 0.7F, 0.2F}, { 0.9F, 0.5F, 0.85F}, { 0.6F, 0.7F, 0.95F}, { 0.9F, 0.9F, 0.2F}, { 0.5F, 0.8F, 0.1F}, { 0.95F, 0.7F, 0.8F}, { 0.3F, 0.3F, 0.3F}, { 0.6F, 0.6F, 0.6F}, { 0.3F, 0.6F, 0.7F}, { 0.7F, 0.4F, 0.9F}, { 0.2F, 0.4F, 0.8F}, { 0.5F, 0.4F, 0.3F}, { 0.4F, 0.5F, 0.2F}, { 0.8F, 0.3F, 0.3F}, { 0.1F, 0.1F, 0.1F}}; public EntitySheep(World world) { super(world); - aP = "/mob/sheep.png"; - a(0.9F, 1.3F); + this.texture = "/mob/sheep.png"; + this.a(0.9F, 1.3F); + // CraftBukkit start - CraftServer server = ((WorldServer) this.l).getServer(); + CraftServer server = ((WorldServer) this.world).getServer(); this.bukkitEntity = new CraftSheep(server, this); // CraftBukkit end } protected void a() { super.a(); - af.a(16, ((new Byte((byte) 0)))); + this.datawatcher.a(16, new Byte((byte) 0)); } public boolean a(Entity entity, int i) { - if (!l.z && !f_() && (entity instanceof EntityLiving)) { - a(true); - int j = 1 + W.nextInt(3); + if (!this.world.isStatic && !this.f_() && entity instanceof EntityLiving) { + this.a(true); + int j = 1 + this.random.nextInt(3); - for (int k = 0; k < j; k++) { - EntityItem entityitem = a(new ItemStack(Block.ab.bi, 1, e_()), 1.0F); + for (int k = 0; k < j; ++k) { + EntityItem entityitem = this.a(new ItemStack(Block.WOOL.id, 1, this.e_()), 1.0F); - entityitem.t += W.nextFloat() * 0.05F; - entityitem.s += (W.nextFloat() - W.nextFloat()) * 0.1F; - entityitem.u += (W.nextFloat() - W.nextFloat()) * 0.1F; + entityitem.motY += (double) (this.random.nextFloat() * 0.05F); + entityitem.motX += (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F); + entityitem.motZ += (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F); } } + return super.a(entity, i); } public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); - nbttagcompound.a("Sheared", f_()); - nbttagcompound.a("Color", (byte) e_()); + nbttagcompound.a("Sheared", this.f_()); + nbttagcompound.a("Color", (byte) this.e_()); } public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); - a(nbttagcompound.l("Sheared")); - a(((int) (nbttagcompound.b("Color")))); + this.a(nbttagcompound.l("Sheared")); + this.a(nbttagcompound.b("Color")); } protected String e() { @@ -101,38 +69,32 @@ public class EntitySheep extends EntityAnimals { } public int e_() { - return af.a(16) & 0xf; + return this.datawatcher.a(16) & 15; } public void a(int i) { - byte byte0 = af.a(16); + byte b0 = this.datawatcher.a(16); - af.b(16, ((Byte.valueOf((byte) (byte0 & 0xf0 | i & 0xf))))); + this.datawatcher.b(16, Byte.valueOf((byte) (b0 & 240 | i & 15))); } public boolean f_() { - return (af.a(16) & 0x10) != 0; + return (this.datawatcher.a(16) & 16) != 0; } public void a(boolean flag) { - byte byte0 = af.a(16); + byte b0 = this.datawatcher.a(16); if (flag) { - af.b(16, ((Byte.valueOf((byte) (byte0 | 0x10))))); + this.datawatcher.b(16, Byte.valueOf((byte) (b0 | 16))); } else { - af.b(16, ((Byte.valueOf((byte) (byte0 & 0xffffffef))))); + this.datawatcher.b(16, Byte.valueOf((byte) (b0 & -17))); } } public static int a(Random random) { int i = random.nextInt(100); - if (i < 5) { - return 15; - } - if (i < 10) { - return 7; - } - return i >= 15 ? 0 : 8; + return i < 5 ? 15 : (i < 10 ? 7 : (i < 15 ? 8 : 0)); } } |