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/EntityFish.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/EntityFish.java')
-rw-r--r-- | src/main/java/net/minecraft/server/EntityFish.java | 568 |
1 files changed, 290 insertions, 278 deletions
diff --git a/src/main/java/net/minecraft/server/EntityFish.java b/src/main/java/net/minecraft/server/EntityFish.java index 4d63e7c0..a654b0a5 100644 --- a/src/main/java/net/minecraft/server/EntityFish.java +++ b/src/main/java/net/minecraft/server/EntityFish.java @@ -1,7 +1,6 @@ package net.minecraft.server; import java.util.List; -import java.util.Random; // CraftBukkit start import org.bukkit.craftbukkit.entity.CraftFish; @@ -13,17 +12,17 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause; public class EntityFish extends Entity { - private int d; - private int e; - private int f; - private int ak; - private boolean al; - public int a; - public EntityPlayer b; + private int d = -1; + private int e = -1; + private int f = -1; + private int ak = 0; + private boolean al = false; + public int a = 0; + public EntityHuman b; private int am; - private int an; - private int ao; - public Entity c; + private int an = 0; + private int ao = 0; + public Entity c = null; private int ap; private double aq; private double ar; @@ -33,332 +32,345 @@ public class EntityFish extends Entity { public EntityFish(World world) { super(world); - d = -1; - e = -1; - f = -1; - ak = 0; - al = false; - a = 0; - an = 0; - ao = 0; - c = null; - a(0.25F, 0.25F); + this.a(0.25F, 0.25F); + //CraftBukkit start - CraftServer server = ((WorldServer) this.l).getServer(); + CraftServer server = ((WorldServer) this.world).getServer(); this.bukkitEntity = new CraftFish(server, this); //CraftBukkit end } protected void a() {} - public EntityFish(World world, EntityPlayer entityplayer) { - // CraftBukkit start - this(world); - // CraftBukkit end - - b = entityplayer; - b.aE = this; - c(entityplayer.p, (entityplayer.q + 1.6200000000000001D) - (double) entityplayer.H, entityplayer.r, entityplayer.v, entityplayer.w); - p -= MathHelper.b((v / 180F) * 3.141593F) * 0.16F; - q -= 0.10000000149011612D; - r -= MathHelper.a((v / 180F) * 3.141593F) * 0.16F; - a(p, q, r); - H = 0.0F; - float f1 = 0.4F; - - s = -MathHelper.a((v / 180F) * 3.141593F) * MathHelper.b((w / 180F) * 3.141593F) * f1; - u = MathHelper.b((v / 180F) * 3.141593F) * MathHelper.b((w / 180F) * 3.141593F) * f1; - t = -MathHelper.a((w / 180F) * 3.141593F) * f1; - a(s, t, u, 1.5F, 1.0F); + public EntityFish(World world, EntityHuman entityhuman) { + this(world); // CraftBukkit super->this so we assign the entity + + this.b = entityhuman; + this.b.hookedFish = this; + this.a(0.25F, 0.25F); + this.c(entityhuman.locX, entityhuman.locY + 1.62D - (double) entityhuman.height, entityhuman.locZ, entityhuman.yaw, entityhuman.pitch); + this.locX -= (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * 0.16F); + this.locY -= 0.10000000149011612D; + this.locZ -= (double) (MathHelper.a(this.yaw / 180.0F * 3.1415927F) * 0.16F); + this.a(this.locX, this.locY, this.locZ); + this.height = 0.0F; + float f = 0.4F; + + this.motX = (double) (-MathHelper.a(this.yaw / 180.0F * 3.1415927F) * MathHelper.b(this.pitch / 180.0F * 3.1415927F) * f); + this.motZ = (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * MathHelper.b(this.pitch / 180.0F * 3.1415927F) * f); + this.motY = (double) (-MathHelper.a(this.pitch / 180.0F * 3.1415927F) * f); + this.a(this.motX, this.motY, this.motZ, 1.5F, 1.0F); } - public void a(double d1, double d2, double d3, float f1, float f2) { - float f3 = MathHelper.a(d1 * d1 + d2 * d2 + d3 * d3); - - d1 /= f3; - d2 /= f3; - d3 /= f3; - d1 += W.nextGaussian() * 0.0074999998323619366D * (double) f2; - d2 += W.nextGaussian() * 0.0074999998323619366D * (double) f2; - d3 += W.nextGaussian() * 0.0074999998323619366D * (double) f2; - d1 *= f1; - d2 *= f1; - d3 *= f1; - s = d1; - t = d2; - u = d3; - float f4 = MathHelper.a(d1 * d1 + d3 * d3); - - x = v = (float) ((Math.atan2(d1, d3) * 180D) / 3.1415927410125732D); - y = w = (float) ((Math.atan2(d2, f4) * 180D) / 3.1415927410125732D); - am = 0; + public void a(double d0, double d1, double d2, float f, float f1) { + float f2 = MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2); + + d0 /= (double) f2; + d1 /= (double) f2; + d2 /= (double) f2; + d0 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1; + d1 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1; + d2 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1; + d0 *= (double) f; + d1 *= (double) f; + d2 *= (double) f; + this.motX = d0; + this.motY = d1; + this.motZ = d2; + float f3 = MathHelper.a(d0 * d0 + d2 * d2); + + this.lastYaw = this.yaw = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D); + this.lastPitch = this.pitch = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D); + this.am = 0; } public void b_() { super.b_(); - if (ap > 0) { - double d1 = p + (aq - p) / (double) ap; - double d2 = q + (ar - q) / (double) ap; - double d3 = r + (as - r) / (double) ap; - double d4; + if (this.ap > 0) { + double d0 = this.locX + (this.aq - this.locX) / (double) this.ap; + double d1 = this.locY + (this.ar - this.locY) / (double) this.ap; + double d2 = this.locZ + (this.as - this.locZ) / (double) this.ap; - for (d4 = at - (double) v; d4 < -180D; d4 += 360D) { - ; - } - for (; d4 >= 180D; d4 -= 360D) { + double d3; + + for (d3 = this.at - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) { ; } - v += ((float) (d4 / (double) ap)); - w += ((float) ((au - (double) w) / (double) ap)); - ap--; - a(d1, d2, d3); - b(v, w); - return; - } - if (!this.l.z) { - ItemStack itemstack = b.P(); - if (b.G || !b.B() || itemstack == null || itemstack.a() != Item.aP || b(((Entity) (b))) > 1024D) { - q(); - b.aE = null; - return; + while (d3 >= 180.0D) { + d3 -= 360.0D; } - if (c != null) { - if (c.G) { - c = null; - } else { - p = c.p; - q = c.z.b + (double) c.J * 0.80000000000000004D; - r = c.r; + + this.yaw = (float) ((double) this.yaw + d3 / (double) this.ap); + this.pitch = (float) ((double) this.pitch + (this.au - (double) this.pitch) / (double) this.ap); + --this.ap; + this.a(d0, d1, d2); + this.b(this.yaw, this.pitch); + } else { + if (!this.world.isStatic) { + ItemStack itemstack = this.b.P(); + + // CraftBukkit - cast this.b to Entity + if (this.b.dead || !this.b.B() || itemstack == null || itemstack.a() != Item.FISHING_ROD || this.b((Entity) this.b) > 1024.0D) { + this.q(); + this.b.hookedFish = null; return; } + + if (this.c != null) { + if (!this.c.dead) { + this.locX = this.c.locX; + this.locY = this.c.boundingBox.b + (double) this.c.width * 0.8D; + this.locZ = this.c.locZ; + return; + } + + this.c = null; + } } - } - if (a > 0) { - a--; - } - if (al) { - int i = this.l.a(d, e, f); - - if (i != ak) { - al = false; - s *= W.nextFloat() * 0.2F; - t *= W.nextFloat() * 0.2F; - u *= W.nextFloat() * 0.2F; - am = 0; - an = 0; - } else { - am++; - if (am == 1200) { - q(); + + if (this.a > 0) { + --this.a; + } + + if (this.al) { + int i = this.world.getTypeId(this.d, this.e, this.f); + + if (i == this.ak) { + ++this.am; + if (this.am == 1200) { + this.q(); + } + + return; } - return; + + this.al = false; + this.motX *= (double) (this.random.nextFloat() * 0.2F); + this.motY *= (double) (this.random.nextFloat() * 0.2F); + this.motZ *= (double) (this.random.nextFloat() * 0.2F); + this.am = 0; + this.an = 0; + } else { + ++this.an; } - } else { - an++; - } - Vec3D vec3d = Vec3D.b(p, q, r); - Vec3D vec3d1 = Vec3D.b(p + s, q + t, r + u); - MovingObjectPosition movingobjectposition = this.l.a(vec3d, vec3d1); - - vec3d = Vec3D.b(p, q, r); - vec3d1 = Vec3D.b(p + s, q + t, r + u); - if (movingobjectposition != null) { - vec3d1 = Vec3D.b(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c); - } - Entity entity = null; - List list = this.l.b(((Entity) (this)), z.a(s, t, u).b(1.0D, 1.0D, 1.0D)); - double d5 = 0.0D; - for (int j = 0; j < list.size(); j++) { - Entity entity1 = (Entity) list.get(j); + Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ); + Vec3D vec3d1 = Vec3D.b(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ); + MovingObjectPosition movingobjectposition = this.world.a(vec3d, vec3d1); - if (!entity1.c_() || entity1 == b && an < 5) { - continue; + vec3d = Vec3D.b(this.locX, this.locY, this.locZ); + vec3d1 = Vec3D.b(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ); + if (movingobjectposition != null) { + vec3d1 = Vec3D.b(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c); } - float f3 = 0.3F; - AxisAlignedBB axisalignedbb = entity1.z.b(f3, f3, f3); - MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); - if (movingobjectposition1 == null) { - continue; + Entity entity = null; + List list = this.world.b((Entity) this, this.boundingBox.a(this.motX, this.motY, this.motZ).b(1.0D, 1.0D, 1.0D)); + double d4 = 0.0D; + + double d5; + + for (int j = 0; j < list.size(); ++j) { + Entity entity1 = (Entity) list.get(j); + + if (entity1.c_() && (entity1 != this.b || this.an >= 5)) { + float f = 0.3F; + AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f); + MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); + + if (movingobjectposition1 != null) { + d5 = vec3d.a(movingobjectposition1.f); + if (d5 < d4 || d4 == 0.0D) { + entity = entity1; + d4 = d5; + } + } + } } - double d6 = vec3d.a(movingobjectposition1.f); - if (d6 < d5 || d5 == 0.0D) { - entity = entity1; - d5 = d6; + if (entity != null) { + movingobjectposition = new MovingObjectPosition(entity); } - } - if (entity != null) { - movingobjectposition = new MovingObjectPosition(entity); - } - if (movingobjectposition != null) { - if (movingobjectposition.g != null) { - // CraftBukkit start - // TODO add EntityDamagedByProjectileEvent : fishing hook? - boolean bounce; - if (movingobjectposition.g instanceof EntityLiving) { - CraftServer server = ((WorldServer) this.l).getServer(); - org.bukkit.entity.Entity shooter = (b == null)?null:b.getBukkitEntity(); - org.bukkit.entity.Entity damagee = movingobjectposition.g.getBukkitEntity(); - org.bukkit.entity.Entity projectile = this.getBukkitEntity(); - DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK; - int damage = 0; - - // TODO @see EntityArrow#162 - EntityDamageByProjectileEvent edbpe = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage); - server.getPluginManager().callEvent(edbpe); - - if(!edbpe.isCancelled()) { - // this function returns if the fish should stick or not, i.e. !bounce - bounce = !movingobjectposition.g.a(((Entity) (b)), edbpe.getDamage()); + if (movingobjectposition != null) { + if (movingobjectposition.g != null) { + // CraftBukkit start + // TODO add EntityDamagedByProjectileEvent : fishing hook? + boolean stick; + if (movingobjectposition.g instanceof EntityLiving) { + CraftServer server = ((WorldServer) this.world).getServer(); + org.bukkit.entity.Entity shooter = (this.b == null) ? null : this.b.getBukkitEntity(); + org.bukkit.entity.Entity damagee = movingobjectposition.g.getBukkitEntity(); + org.bukkit.entity.Entity projectile = this.getBukkitEntity(); + DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK; + int damage = 0; + + // TODO @see EntityArrow#162 + EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage); + server.getPluginManager().callEvent(event); + + if(!event.isCancelled()) { + // this function returns if the fish should stick or not, i.e. !bounce + stick = movingobjectposition.g.a(this.b, event.getDamage()); + } else { + // event was cancelled, get if the fish should bounce or not + stick = !event.getBounce(); + } } else { - // event was cancelled, get if the fish should bounce or not - bounce = edbpe.getBounce(); + stick = movingobjectposition.g.a(this.b, 0); + } + if (!stick) { + c = movingobjectposition.g; } - } else { - bounce = !movingobjectposition.g.a(((Entity) (b)), 0); - } - if (!bounce) { // CraftBukkit end - c = movingobjectposition.g; + } else { + this.al = true; } - } else { - al = true; } - } - if (al) { - return; - } - c(s, t, u); - float f1 = MathHelper.a(s * s + u * u); - v = (float) ((Math.atan2(s, u) * 180D) / 3.1415927410125732D); - for (w = (float) ((Math.atan2(t, f1) * 180D) / 3.1415927410125732D); w - y < -180F; y -= 360F) { - ; - } - for (; w - y >= 180F; y += 360F) { - ; - } - for (; v - x < -180F; x -= 360F) { - ; - } - for (; v - x >= 180F; x += 360F) { - ; - } - w = y + (w - y) * 0.2F; - v = x + (v - x) * 0.2F; - float f2 = 0.92F; + if (!this.al) { + this.c(this.motX, this.motY, this.motZ); + float f1 = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ); - if (A || B) { - f2 = 0.5F; - } - int k = 5; - double d8 = 0.0D; + this.yaw = (float) (Math.atan2(this.motX, this.motZ) * 180.0D / 3.1415927410125732D); - for (int l = 0; l < k; l++) { - double d9 = ((z.b + ((z.e - z.b) * (double) (l + 0)) / (double) k) - 0.125D) + 0.125D; - double d10 = ((z.b + ((z.e - z.b) * (double) (l + 1)) / (double) k) - 0.125D) + 0.125D; - AxisAlignedBB axisalignedbb1 = AxisAlignedBB.b(z.a, d9, z.c, z.d, d10, z.f); + for (this.pitch = (float) (Math.atan2(this.motY, (double) f1) * 180.0D / 3.1415927410125732D); this.pitch - this.lastPitch < -180.0F; this.lastPitch -= 360.0F) { + ; + } - if (this.l.b(axisalignedbb1, Material.f)) { - d8 += 1.0D / (double) k; - } - } + while (this.pitch - this.lastPitch >= 180.0F) { + this.lastPitch += 360.0F; + } - if (d8 > 0.0D) { - if (ao > 0) { - ao--; - } else if (W.nextInt(500) == 0) { - ao = W.nextInt(30) + 10; - t -= 0.20000000298023224D; - this.l.a(((Entity) (this)), "random.splash", 0.25F, 1.0F + (W.nextFloat() - W.nextFloat()) * 0.4F); - float f4 = MathHelper.b(z.b); + while (this.yaw - this.lastYaw < -180.0F) { + this.lastYaw -= 360.0F; + } - for (int i1 = 0; (float) i1 < 1.0F + I * 20F; i1++) { - float f5 = (W.nextFloat() * 2.0F - 1.0F) * I; - float f7 = (W.nextFloat() * 2.0F - 1.0F) * I; + while (this.yaw - this.lastYaw >= 180.0F) { + this.lastYaw += 360.0F; + } + + this.pitch = this.lastPitch + (this.pitch - this.lastPitch) * 0.2F; + this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F; + float f2 = 0.92F; - this.l.a("bubble", p + (double) f5, f4 + 1.0F, r + (double) f7, s, t - (double) (W.nextFloat() * 0.2F), u); + if (this.onGround || this.B) { + f2 = 0.5F; } - for (int j1 = 0; (float) j1 < 1.0F + I * 20F; j1++) { - float f6 = (W.nextFloat() * 2.0F - 1.0F) * I; - float f8 = (W.nextFloat() * 2.0F - 1.0F) * I; + byte b0 = 5; + double d6 = 0.0D; + + for (int k = 0; k < b0; ++k) { + double d7 = this.boundingBox.b + (this.boundingBox.e - this.boundingBox.b) * (double) (k + 0) / (double) b0 - 0.125D + 0.125D; + double d8 = this.boundingBox.b + (this.boundingBox.e - this.boundingBox.b) * (double) (k + 1) / (double) b0 - 0.125D + 0.125D; + AxisAlignedBB axisalignedbb1 = AxisAlignedBB.b(this.boundingBox.a, d7, this.boundingBox.c, this.boundingBox.d, d8, this.boundingBox.f); - this.l.a("splash", p + (double) f6, f4 + 1.0F, r + (double) f8, s, t, u); + if (this.world.b(axisalignedbb1, Material.WATER)) { + d6 += 1.0D / (double) b0; + } } - } - } - if (ao > 0) { - t -= (double) (W.nextFloat() * W.nextFloat() * W.nextFloat()) * 0.20000000000000001D; - } - double d7 = d8 * 2D - 1.0D; - t += 0.039999999105930328D * d7; - if (d8 > 0.0D) { - f2 = (float) ((double) f2 * 0.90000000000000002D); - t *= 0.80000000000000004D; + if (d6 > 0.0D) { + if (this.ao > 0) { + --this.ao; + } else if (this.random.nextInt(500) == 0) { + this.ao = this.random.nextInt(30) + 10; + this.motY -= 0.20000000298023224D; + this.world.a(this, "random.splash", 0.25F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F); + float f3 = (float) MathHelper.b(this.boundingBox.b); + + int l; + float f4; + float f5; + + for (l = 0; (float) l < 1.0F + this.length * 20.0F; ++l) { + f4 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; + f5 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; + this.world.a("bubble", this.locX + (double) f4, (double) (f3 + 1.0F), this.locZ + (double) f5, this.motX, this.motY - (double) (this.random.nextFloat() * 0.2F), this.motZ); + } + + for (l = 0; (float) l < 1.0F + this.length * 20.0F; ++l) { + f4 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; + f5 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; + this.world.a("splash", this.locX + (double) f4, (double) (f3 + 1.0F), this.locZ + (double) f5, this.motX, this.motY, this.motZ); + } + } + } + + if (this.ao > 0) { + this.motY -= (double) (this.random.nextFloat() * this.random.nextFloat() * this.random.nextFloat()) * 0.2D; + } + + d5 = d6 * 2.0D - 1.0D; + this.motY += 0.03999999910593033D * d5; + if (d6 > 0.0D) { + f2 = (float) ((double) f2 * 0.9D); + this.motY *= 0.8D; + } + + this.motX *= (double) f2; + this.motY *= (double) f2; + this.motZ *= (double) f2; + this.a(this.locX, this.locY, this.locZ); + } } - s *= f2; - t *= f2; - u *= f2; - a(p, q, r); } public void a(NBTTagCompound nbttagcompound) { - nbttagcompound.a("xTile", (short) d); - nbttagcompound.a("yTile", (short) e); - nbttagcompound.a("zTile", (short) f); - nbttagcompound.a("inTile", (byte) ak); - nbttagcompound.a("shake", (byte) a); - nbttagcompound.a("inGround", (byte) (al ? 1 : 0)); + nbttagcompound.a("xTile", (short) this.d); + nbttagcompound.a("yTile", (short) this.e); + nbttagcompound.a("zTile", (short) this.f); + nbttagcompound.a("inTile", (byte) this.ak); + nbttagcompound.a("shake", (byte) this.a); + nbttagcompound.a("inGround", (byte) (this.al ? 1 : 0)); } public void b(NBTTagCompound nbttagcompound) { - d = ((int) (nbttagcompound.c("xTile"))); - e = ((int) (nbttagcompound.c("yTile"))); - f = ((int) (nbttagcompound.c("zTile"))); - ak = nbttagcompound.b("inTile") & 0xff; - a = nbttagcompound.b("shake") & 0xff; - al = nbttagcompound.b("inGround") == 1; + this.d = nbttagcompound.c("xTile"); + this.e = nbttagcompound.c("yTile"); + this.f = nbttagcompound.c("zTile"); + this.ak = nbttagcompound.b("inTile") & 255; + this.a = nbttagcompound.b("shake") & 255; + this.al = nbttagcompound.b("inGround") == 1; } public int d() { - byte byte0 = 0; - - if (c != null) { - double d1 = b.p - p; - double d2 = b.q - q; - double d3 = b.r - r; - double d4 = MathHelper.a(d1 * d1 + d2 * d2 + d3 * d3); - double d5 = 0.10000000000000001D; - - c.s += d1 * d5; - c.t += d2 * d5 + (double) MathHelper.a(d4) * 0.080000000000000002D; - c.u += d3 * d5; - byte0 = 3; - } else if (ao > 0) { - EntityItem entityitem = new EntityItem(l, p, q, r, new ItemStack(Item.aS)); - double d6 = b.p - p; - double d7 = b.q - q; - double d8 = b.r - r; - double d9 = MathHelper.a(d6 * d6 + d7 * d7 + d8 * d8); - double d10 = 0.10000000000000001D; - - entityitem.s = d6 * d10; - entityitem.t = d7 * d10 + (double) MathHelper.a(d9) * 0.080000000000000002D; - entityitem.u = d8 * d10; - l.a(((Entity) (entityitem))); - byte0 = 1; + byte b0 = 0; + + if (this.c != null) { + double d0 = this.b.locX - this.locX; + double d1 = this.b.locY - this.locY; + double d2 = this.b.locZ - this.locZ; + double d3 = (double) MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2); + double d4 = 0.1D; + + this.c.motX += d0 * d4; + this.c.motY += d1 * d4 + (double) MathHelper.a(d3) * 0.08D; + this.c.motZ += d2 * d4; + b0 = 3; + } else if (this.ao > 0) { + EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.RAW_FISH)); + double d5 = this.b.locX - this.locX; + double d6 = this.b.locY - this.locY; + double d7 = this.b.locZ - this.locZ; + double d8 = (double) MathHelper.a(d5 * d5 + d6 * d6 + d7 * d7); + double d9 = 0.1D; + + entityitem.motX = d5 * d9; + entityitem.motY = d6 * d9 + (double) MathHelper.a(d8) * 0.08D; + entityitem.motZ = d7 * d9; + this.world.a((Entity) entityitem); + b0 = 1; } - if (al) { - byte0 = 2; + + if (this.al) { + b0 = 2; } - q(); - b.aE = null; - return ((int) (byte0)); + + this.q(); + this.b.hookedFish = null; + return b0; } } |