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/EntitySquid.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/EntitySquid.java')
-rw-r--r-- | src/main/java/net/minecraft/server/EntitySquid.java | 165 |
1 files changed, 77 insertions, 88 deletions
diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java index 4e8fdb70..a13757c6 100644 --- a/src/main/java/net/minecraft/server/EntitySquid.java +++ b/src/main/java/net/minecraft/server/EntitySquid.java @@ -1,50 +1,35 @@ package net.minecraft.server; -import java.util.Random; - // CraftBukkit start import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.entity.CraftSquid; // CraftBukkit stop -public class EntitySquid extends EntityWaterMob { - - public float a; - public float b; - public float c; - public float f; - public float ak; - public float al; - public float am; - public float an; - private float ao; - private float ap; - private float aq; - private float ar; - private float as; - private float at; +public class EntitySquid extends EntityWaterAnimal { + + public float a = 0.0F; + public float b = 0.0F; + public float c = 0.0F; + public float f = 0.0F; + public float ak = 0.0F; + public float al = 0.0F; + public float am = 0.0F; + public float an = 0.0F; + private float ao = 0.0F; + private float ap = 0.0F; + private float aq = 0.0F; + private float ar = 0.0F; + private float as = 0.0F; + private float at = 0.0F; public EntitySquid(World world) { super(world); - a = 0.0F; - b = 0.0F; - c = 0.0F; - f = 0.0F; - ak = 0.0F; - al = 0.0F; - am = 0.0F; - an = 0.0F; - ao = 0.0F; - ap = 0.0F; - aq = 0.0F; - ar = 0.0F; - as = 0.0F; - at = 0.0F; - aP = "/mob/squid.png"; - a(0.95F, 0.95F); - ap = (1.0F / (W.nextFloat() + 1.0F)) * 0.2F; + this.texture = "/mob/squid.png"; + this.a(0.95F, 0.95F); + this.ap = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F; + // CraftBukkit start - CraftServer server = ((WorldServer) this.l).getServer(); + CraftServer server = ((WorldServer) this.world).getServer(); this.bukkitEntity = new CraftSquid(server, this); // CraftBukkit end } @@ -78,18 +63,18 @@ public class EntitySquid extends EntityWaterMob { } protected void g_() { - int j = W.nextInt(3) + 1; + int i = this.random.nextInt(3) + 1; - for (int k = 0; k < j; k++) { - a(new ItemStack(Item.aU, 1, 0), 0.0F); + for (int j = 0; j < i; ++j) { + this.a(new ItemStack(Item.INK_SACK, 1, 0), 0.0F); } } - public boolean a(EntityPlayer entityplayer) { - ItemStack itemstack = entityplayer.an.e(); + public boolean a(EntityHuman entityhuman) { + ItemStack itemstack = entityhuman.inventory.e(); - if (itemstack != null && itemstack.c == Item.au.ba) { - entityplayer.an.a(entityplayer.an.c, new ItemStack(Item.aE)); + if (itemstack != null && itemstack.id == Item.BUCKET.id) { + entityhuman.inventory.a(entityhuman.inventory.c, new ItemStack(Item.MILK_BUCKET)); return true; } else { return false; @@ -97,72 +82,76 @@ public class EntitySquid extends EntityWaterMob { } public boolean v() { - return l.a(z.b(0.0D, -0.60000002384185791D, 0.0D), Material.f, ((Entity) (this))); + return this.world.a(this.boundingBox.b(0.0D, -0.6000000238418579D, 0.0D), Material.WATER, this); } public void o() { super.o(); - b = a; - f = c; - al = ak; - an = am; - ak += ap; - if (ak > 6.283185F) { - ak -= 6.283185F; - if (W.nextInt(10) == 0) { - ap = (1.0F / (W.nextFloat() + 1.0F)) * 0.2F; + this.b = this.a; + this.f = this.c; + this.al = this.ak; + this.an = this.am; + this.ak += this.ap; + if (this.ak > 6.2831855F) { + this.ak -= 6.2831855F; + if (this.random.nextInt(10) == 0) { + this.ap = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F; } } - if (v()) { - if (ak < 3.141593F) { - float f1 = ak / 3.141593F; - - am = MathHelper.a(f1 * f1 * 3.141593F) * 3.141593F * 0.25F; - if ((double) f1 > 0.75D) { - ao = 1.0F; - aq = 1.0F; + + if (this.v()) { + float f; + + if (this.ak < 3.1415927F) { + f = this.ak / 3.1415927F; + this.am = MathHelper.a(f * f * 3.1415927F) * 3.1415927F * 0.25F; + if ((double) f > 0.75D) { + this.ao = 1.0F; + this.aq = 1.0F; } else { - aq = aq * 0.8F; + this.aq *= 0.8F; } } else { - am = 0.0F; - ao = ao * 0.9F; - aq = aq * 0.99F; + this.am = 0.0F; + this.ao *= 0.9F; + this.aq *= 0.99F; } - if (!aW) { - s = ar * ao; - t = as * ao; - u = at * ao; + + if (!this.aW) { + this.motX = (double) (this.ar * this.ao); + this.motY = (double) (this.as * this.ao); + this.motZ = (double) (this.at * this.ao); } - float f2 = MathHelper.a(s * s + u * u); - aI += ((-(float) Math.atan2(s, u) * 180F) / 3.141593F - aI) * 0.1F; - v = aI; - c = c + 3.141593F * aq * 1.5F; - a += ((-(float) Math.atan2(f2, t) * 180F) / 3.141593F - a) * 0.1F; + f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ); + this.aI += (-((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F - this.aI) * 0.1F; + this.yaw = this.aI; + this.c += 3.1415927F * this.aq * 1.5F; + this.a += (-((float) Math.atan2((double) f, this.motY)) * 180.0F / 3.1415927F - this.a) * 0.1F; } else { - am = MathHelper.e(MathHelper.a(ak)) * 3.141593F * 0.25F; - if (!aW) { - s = 0.0D; - t -= 0.080000000000000002D; - t *= 0.98000001907348633D; - u = 0.0D; + this.am = MathHelper.e(MathHelper.a(this.ak)) * 3.1415927F * 0.25F; + if (!this.aW) { + this.motX = 0.0D; + this.motY -= 0.08D; + this.motY *= 0.9800000190734863D; + this.motZ = 0.0D; } - a += ((float) ((double) (-90F - a) * 0.02D)); + + this.a = (float) ((double) this.a + (double) (-90.0F - this.a) * 0.02D); } } - public void c(float f1, float f2) { - c(s, t, u); + public void c(float f, float f1) { + this.c(this.motX, this.motY, this.motZ); } protected void d() { - if (W.nextInt(50) == 0 || !ab || ar == 0.0F && as == 0.0F && at == 0.0F) { - float f1 = W.nextFloat() * 3.141593F * 2.0F; + if (this.random.nextInt(50) == 0 || !this.ab || this.ar == 0.0F && this.as == 0.0F && this.at == 0.0F) { + float f = this.random.nextFloat() * 3.1415927F * 2.0F; - ar = MathHelper.b(f1) * 0.2F; - as = -0.1F + W.nextFloat() * 0.2F; - at = MathHelper.a(f1) * 0.2F; + this.ar = MathHelper.b(f) * 0.2F; + this.as = -0.1F + this.random.nextFloat() * 0.2F; + this.at = MathHelper.a(f) * 0.2F; } } } |