diff options
Diffstat (limited to 'src/main')
23 files changed, 3108 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/EntityAnimals.java b/src/main/java/net/minecraft/server/EntityAnimals.java new file mode 100644 index 00000000..0cb764f4 --- /dev/null +++ b/src/main/java/net/minecraft/server/EntityAnimals.java @@ -0,0 +1,36 @@ +package net.minecraft.server; + +public abstract class EntityAnimals extends EntityCreature implements IAnimals { + + public EntityAnimals(World world) { + super(world); + } + + protected float a(int i, int j, int k) { + if (l.a(i, j - 1, k) == Block.u.bi) { + return 10F; + } else { + return l.l(i, j, k) - 0.5F; + } + } + + public void a(NBTTagCompound nbttagcompound) { + super.a(nbttagcompound); + } + + public void b(NBTTagCompound nbttagcompound) { + super.b(nbttagcompound); + } + + public boolean b() { + int i = MathHelper.b(p); + int j = MathHelper.b(z.b); + int k = MathHelper.b(r); + + return l.a(i, j - 1, k) == Block.u.bi && l.j(i, j, k) > 8 && super.b(); + } + + public int c() { + return 120; + } +} diff --git a/src/main/java/net/minecraft/server/EntityChicken.java b/src/main/java/net/minecraft/server/EntityChicken.java new file mode 100644 index 00000000..6663ce90 --- /dev/null +++ b/src/main/java/net/minecraft/server/EntityChicken.java @@ -0,0 +1,78 @@ +package net.minecraft.server; + +import java.util.Random; + +public class EntityChicken extends EntityAnimals { + + public boolean a; + public float b; + public float c; + public float f; + public float ak; + public float al; + public int am; + + public EntityChicken(World world) { + super(world); + a = false; + b = 0.0F; + c = 0.0F; + al = 1.0F; + aP = "/mob/chicken.png"; + a(0.3F, 0.4F); + aZ = 4; + am = W.nextInt(6000) + 6000; + } + + public void o() { + super.o(); + ak = b; + f = c; + c += ((float) ((double) (A ? -1 : 4) * 0.29999999999999999D)); + if (c < 0.0F) { + c = 0.0F; + } + if (c > 1.0F) { + c = 1.0F; + } + if (!A && al < 1.0F) { + al = 1.0F; + } + al *= 0.90000000000000002D; + if (!A && t < 0.0D) { + t *= 0.59999999999999998D; + } + b += al * 2.0F; + if (!l.z && --am <= 0) { + l.a(((Entity) (this)), "mob.chickenplop", 1.0F, (W.nextFloat() - W.nextFloat()) * 0.2F + 1.0F); + a(Item.aN.ba, 1); + am = W.nextInt(6000) + 6000; + } + } + + protected void a(float f1) {} + + public void a(NBTTagCompound nbttagcompound) { + super.a(nbttagcompound); + } + + public void b(NBTTagCompound nbttagcompound) { + super.b(nbttagcompound); + } + + protected String e() { + return "mob.chicken"; + } + + protected String f() { + return "mob.chickenhurt"; + } + + protected String g() { + return "mob.chickenhurt"; + } + + protected int h() { + return Item.J.ba; + } +} diff --git a/src/main/java/net/minecraft/server/EntityCow.java b/src/main/java/net/minecraft/server/EntityCow.java new file mode 100644 index 00000000..03b49c56 --- /dev/null +++ b/src/main/java/net/minecraft/server/EntityCow.java @@ -0,0 +1,49 @@ +package net.minecraft.server; + +public class EntityCow extends EntityAnimals { + + public EntityCow(World world) { + super(world); + aP = "/mob/cow.png"; + a(0.9F, 1.3F); + } + + public void a(NBTTagCompound nbttagcompound) { + super.a(nbttagcompound); + } + + public void b(NBTTagCompound nbttagcompound) { + super.b(nbttagcompound); + } + + protected String e() { + return "mob.cow"; + } + + protected String f() { + return "mob.cowhurt"; + } + + protected String g() { + return "mob.cowhurt"; + } + + protected float i() { + return 0.4F; + } + + protected int h() { + return Item.aD.ba; + } + + public boolean a(EntityPlayer entityplayer) { + ItemStack itemstack = entityplayer.an.e(); + + if (itemstack != null && itemstack.c == Item.au.ba) { + entityplayer.an.a(entityplayer.an.c, new ItemStack(Item.aE)); + return true; + } else { + return false; + } + } +} diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java new file mode 100644 index 00000000..da584aa4 --- /dev/null +++ b/src/main/java/net/minecraft/server/EntityCreature.java @@ -0,0 +1,149 @@ +package net.minecraft.server; + +import java.util.Random; + +public class EntityCreature extends EntityLiving { + + private PathEntity a; + protected Entity d; + protected boolean e; + + public EntityCreature(World world) { + super(world); + e = false; + } + + protected void d() { + e = false; + float f = 16F; + + if (d == null) { + d = l(); + if (d != null) { + a = l.a(((Entity) (this)), d, f); + } + } else if (!d.B()) { + d = null; + } else { + float f1 = d.a(((Entity) (this))); + + if (i(d)) { + a(d, f1); + } + } + if (!e && d != null && (a == null || W.nextInt(20) == 0)) { + a = l.a(((Entity) (this)), d, f); + } else if (a == null && W.nextInt(80) == 0 || W.nextInt(80) == 0) { + boolean flag = false; + int j = -1; + int k = -1; + int i1 = -1; + float f2 = -99999F; + + for (int j1 = 0; j1 < 10; j1++) { + int k1 = MathHelper.b((p + (double) W.nextInt(13)) - 6D); + int l1 = MathHelper.b((q + (double) W.nextInt(7)) - 3D); + int i2 = MathHelper.b((r + (double) W.nextInt(13)) - 6D); + float f3 = a(k1, l1, i2); + + if (f3 > f2) { + f2 = f3; + j = k1; + k = l1; + i1 = i2; + flag = true; + } + } + + if (flag) { + a = l.a(((Entity) (this)), j, k, i1, 10F); + } + } + int i = MathHelper.b(z.b); + boolean flag1 = v(); + boolean flag2 = x(); + + w = 0.0F; + if (a == null || W.nextInt(100) == 0) { + super.d(); + a = null; + return; + } + Vec3D vec3d = a.a(((Entity) (this))); + + for (double d1 = I * 2.0F; vec3d != null && vec3d.d(p, vec3d.b, r) < d1 * d1;) { + a.a(); + if (a.b()) { + vec3d = null; + a = null; + } else { + vec3d = a.a(((Entity) (this))); + } + } + + bA = false; + if (vec3d != null) { + double d2 = vec3d.a - p; + double d3 = vec3d.c - r; + double d4 = vec3d.b - (double) i; + float f4 = (float) ((Math.atan2(d3, d2) * 180D) / 3.1415927410125732D) - 90F; + float f5 = f4 - v; + + by = bC; + for (; f5 < -180F; f5 += 360F) { + ; + } + for (; f5 >= 180F; f5 -= 360F) { + ; + } + if (f5 > 30F) { + f5 = 30F; + } + if (f5 < -30F) { + f5 = -30F; + } + v += f5; + if (e && d != null) { + double d5 = d.p - p; + double d6 = d.r - r; + float f7 = v; + + v = (float) ((Math.atan2(d6, d5) * 180D) / 3.1415927410125732D) - 90F; + float f6 = (((f7 - v) + 90F) * 3.141593F) / 180F; + + bx = -MathHelper.a(f6) * by * 1.0F; + by = MathHelper.b(f6) * by * 1.0F; + } + if (d4 > 0.0D) { + bA = true; + } + } + if (d != null) { + b(d, 30F); + } + if (B) { + bA = true; + } + if (W.nextFloat() < 0.8F && (flag1 || flag2)) { + bA = true; + } + } + + protected void a(Entity entity, float f) {} + + protected float a(int i, int j, int k) { + return 0.0F; + } + + protected Entity l() { + return null; + } + + public boolean b() { + int i = MathHelper.b(p); + int j = MathHelper.b(z.b); + int k = MathHelper.b(r); + + return super.b() && a(i, j, k) >= 0.0F; + } +} diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java new file mode 100644 index 00000000..06dbdb8c --- /dev/null +++ b/src/main/java/net/minecraft/server/EntityCreeper.java @@ -0,0 +1,96 @@ +package net.minecraft.server; + +import java.util.Random; + +public class EntityCreeper extends EntityMobs { + + int a; + int b; + + public EntityCreeper(World world) { + super(world); + aP = "/mob/creeper.png"; + } + + protected void a() { + super.a(); + af.a(16, ((Byte.valueOf((byte) -1)))); + } + + public void a(NBTTagCompound nbttagcompound) { + super.a(nbttagcompound); + } + + public void b(NBTTagCompound nbttagcompound) { + super.b(nbttagcompound); + } + + public void b_() { + b = a; + if (l.z) { + int i = K(); + + if (i > 0 && a == 0) { + l.a(((Entity) (this)), "random.fuse", 1.0F, 0.5F); + } + a += i; + if (a < 0) { + a = 0; + } + if (a >= 30) { + a = 30; + } + } + super.b_(); + } + + protected String f() { + return "mob.creeper"; + } + + protected String g() { + return "mob.creeperdeath"; + } + + public void f(Entity entity) { + super.f(entity); + if (entity instanceof EntitySkeleton) { + a(Item.aY.ba + W.nextInt(2), 1); + } + } + + protected void a(Entity entity, float f1) { + int i = K(); + + if (i <= 0 && f1 < 3F || i > 0 && f1 < 7F) { + if (a == 0) { + l.a(((Entity) (this)), "random.fuse", 1.0F, 0.5F); + } + a(1); + a++; + if (a >= 30) { + l.a(((Entity) (this)), p, q, r, 3F); + q(); + } + e = true; + } else { + a(-1); + a--; + if (a < 0) { + a = 0; + } + } + } + + protected int h() { + return Item.K.ba; + } + + private int K() { + return ((int) (af.a(16))); + } + + private void a(int i) { + af.b(16, ((Byte.valueOf((byte) i)))); + } +} diff --git a/src/main/java/net/minecraft/server/EntityFallingSand.java b/src/main/java/net/minecraft/server/EntityFallingSand.java new file mode 100644 index 00000000..b384f01c --- /dev/null +++ b/src/main/java/net/minecraft/server/EntityFallingSand.java @@ -0,0 +1,78 @@ +package net.minecraft.server; + +public class EntityFallingSand extends Entity { + + public int a; + public int b; + + public EntityFallingSand(World world) { + super(world); + b = 0; + } + + public EntityFallingSand(World world, double d, double d1, double d2, int i) { + super(world); + b = 0; + a = i; + this.i = true; + a(0.98F, 0.98F); + H = J / 2.0F; + a(d, d1, d2); + s = 0.0D; + t = 0.0D; + u = 0.0D; + M = false; + m = d; + n = d1; + o = d2; + } + + protected void a() {} + + public boolean c_() { + return !G; + } + + public void b_() { + if (a == 0) { + q(); + return; + } + m = p; + n = q; + o = r; + b++; + t -= 0.039999999105930328D; + c(s, t, u); + s *= 0.98000001907348633D; + t *= 0.98000001907348633D; + u *= 0.98000001907348633D; + int i = MathHelper.b(p); + int j = MathHelper.b(q); + int k = MathHelper.b(r); + + if (l.a(i, j, k) == a) { + l.e(i, j, k, 0); + } + if (A) { + s *= 0.69999998807907104D; + u *= 0.69999998807907104D; + t *= -0.5D; + q(); + if ((!l.a(a, i, j, k, true) || !l.e(i, j, k, a)) && !l.z) { + a(a, 1); + } + } else if (b > 100 && !l.z) { + a(a, 1); + q(); + } + } + + protected void a(NBTTagCompound nbttagcompound) { + nbttagcompound.a("Tile", (byte) a); + } + + protected void b(NBTTagCompound nbttagcompound) { + a = nbttagcompound.b("Tile") & 0xff; + } +} diff --git a/src/main/java/net/minecraft/server/EntityFlying.java b/src/main/java/net/minecraft/server/EntityFlying.java new file mode 100644 index 00000000..165d24b7 --- /dev/null +++ b/src/main/java/net/minecraft/server/EntityFlying.java @@ -0,0 +1,67 @@ +package net.minecraft.server; + +public class EntityFlying extends EntityLiving { + + public EntityFlying(World world) { + super(world); + } + + protected void a(float f) {} + + public void c(float f, float f1) { + if (v()) { + a(f, f1, 0.02F); + c(s, t, u); + s *= 0.80000001192092896D; + t *= 0.80000001192092896D; + u *= 0.80000001192092896D; + } else if (x()) { + a(f, f1, 0.02F); + c(s, t, u); + s *= 0.5D; + t *= 0.5D; + u *= 0.5D; + } else { + float f2 = 0.91F; + + if (A) { + f2 = 0.5460001F; + int i = l.a(MathHelper.b(p), MathHelper.b(z.b) - 1, MathHelper.b(r)); + + if (i > 0) { + f2 = Block.m[i].bu * 0.91F; + } + } + float f3 = 0.1627714F / (f2 * f2 * f2); + + a(f, f1, A ? 0.1F * f3 : 0.02F); + f2 = 0.91F; + if (A) { + f2 = 0.5460001F; + int j = l.a(MathHelper.b(p), MathHelper.b(z.b) - 1, MathHelper.b(r)); + + if (j > 0) { + f2 = Block.m[j].bu * 0.91F; + } + } + c(s, t, u); + s *= f2; + t *= f2; + u *= f2; + } + bl = bm; + double d = p - m; + double d1 = r - o; + float f4 = MathHelper.a(d * d + d1 * d1) * 4F; + + if (f4 > 1.0F) { + f4 = 1.0F; + } + bm += (f4 - bm) * 0.4F; + bn += bm; + } + + public boolean m() { + return false; + } +} diff --git a/src/main/java/net/minecraft/server/EntityGhast.java b/src/main/java/net/minecraft/server/EntityGhast.java new file mode 100644 index 00000000..768d581e --- /dev/null +++ b/src/main/java/net/minecraft/server/EntityGhast.java @@ -0,0 +1,145 @@ +package net.minecraft.server; + +import java.util.List; +import java.util.Random; + +public class EntityGhast extends EntityFlying implements IMobs { + + public int a; + public double b; + public double c; + public double d; + private Entity ak; + private int al; + public int e; + public int f; + + public EntityGhast(World world) { + super(world); + a = 0; + ak = null; + al = 0; + e = 0; + f = 0; + aP = "/mob/ghast.png"; + a(4F, 4F); + ae = true; + } + + protected void d() { + if (l.k == 0) { + q(); + } + e = f; + double d1 = b - p; + double d2 = c - q; + double d3 = d - r; + double d4 = MathHelper.a(d1 * d1 + d2 * d2 + d3 * d3); + + if (d4 < 1.0D || d4 > 60D) { + b = p + (double) ((W.nextFloat() * 2.0F - 1.0F) * 16F); + c = q + (double) ((W.nextFloat() * 2.0F - 1.0F) * 16F); + d = r + (double) ((W.nextFloat() * 2.0F - 1.0F) * 16F); + } + if (a-- <= 0) { + a += W.nextInt(5) + 2; + if (a(b, c, d, d4)) { + s += (d1 / d4) * 0.10000000000000001D; + t += (d2 / d4) * 0.10000000000000001D; + u += (d3 / d4) * 0.10000000000000001D; + } else { + b = p; + c = q; + d = r; + } + } + if (ak != null && ak.G) { + ak = null; + } + if (ak == null || al-- <= 0) { + ak = ((Entity) (l.a(((Entity) (this)), 100D))); + if (ak != null) { + al = 20; + } + } + double d5 = 64D; + + if (ak != null && ak.b(((Entity) (this))) < d5 * d5) { + double d6 = ak.p - p; + double d7 = (ak.z.b + (double) (ak.J / 2.0F)) - (q + (double) (J / 2.0F)); + double d8 = ak.r - r; + + aI = v = (-(float) Math.atan2(d6, d8) * 180F) / 3.141593F; + if (i(ak)) { + if (f == 10) { + l.a(((Entity) (this)), "mob.ghast.charge", i(), (W.nextFloat() - W.nextFloat()) * 0.2F + 1.0F); + } + f++; + if (f == 20) { + l.a(((Entity) (this)), "mob.ghast.fireball", i(), (W.nextFloat() - W.nextFloat()) * 0.2F + 1.0F); + EntityFireball entityfireball = new EntityFireball(l, ((EntityLiving) (this)), d6, d7, d8); + double d9 = 4D; + Vec3D vec3d = c(1.0F); + + entityfireball.p = p + vec3d.a * d9; + entityfireball.q = q + (double) (J / 2.0F) + 0.5D; + entityfireball.r = r + vec3d.c * d9; + l.a(((Entity) (entityfireball))); + f = -40; + } + } else if (f > 0) { + f--; + } + } else { + aI = v = (-(float) Math.atan2(s, u) * 180F) / 3.141593F; + if (f > 0) { + f--; + } + } + aP = f <= 10 ? "/mob/ghast.png" : "/mob/ghast_fire.png"; + } + + private boolean a(double d1, double d2, double d3, double d4) { + double d5 = (b - p) / d4; + double d6 = (c - q) / d4; + double d7 = (d - r) / d4; + AxisAlignedBB axisalignedbb = z.b(); + + for (int k = 1; (double) k < d4; k++) { + axisalignedbb.d(d5, d6, d7); + if (l.a(((Entity) (this)), axisalignedbb).size() > 0) { + return false; + } + } + + return true; + } + + protected String e() { + return "mob.ghast.moan"; + } + + protected String f() { + return "mob.ghast.scream"; + } + + protected String g() { + return "mob.ghast.death"; + } + + protected int h() { + return Item.K.ba; + } + + protected float i() { + return 10F; + } + + public boolean b() { + return W.nextInt(20) == 0 && super.b() && l.k > 0; + } + + public int j() { + return 1; + } +} diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java new file mode 100644 index 00000000..8104bd40 --- /dev/null +++ b/src/main/java/net/minecraft/server/EntityItem.java @@ -0,0 +1,191 @@ +package net.minecraft.server; + +import java.util.Random; + +public class EntityItem extends Entity { + + public ItemStack a; + private int e; + public int b; + public int c; + private int f; + public float d; + + public EntityItem(World world, double d1, double d2, double d3, ItemStack itemstack) { + super(world); + b = 0; + f = 5; + d = (float) (Math.random() * 3.1415926535897931D * 2D); + a(0.25F, 0.25F); + H = J / 2.0F; + a(d1, d2, d3); + a = itemstack; + v = (float) (Math.random() * 360D); + s = (float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D); + t = 0.20000000298023224D; + u = (float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D); + M = false; + } + + public EntityItem(World world) { + super(world); + b = 0; + f = 5; + d = (float) (Math.random() * 3.1415926535897931D * 2D); + a(0.25F, 0.25F); + H = J / 2.0F; + } + + protected void a() {} + + public void b_() { + super.b_(); + if (c > 0) { + c--; + } + m = p; + n = q; + o = r; + t -= 0.039999999105930328D; + if (l.c(MathHelper.b(p), MathHelper.b(q), MathHelper.b(r)) == Material.g) { + t = 0.20000000298023224D; + s = (W.nextFloat() - W.nextFloat()) * 0.2F; + u = (W.nextFloat() - W.nextFloat()) * 0.2F; + l.a(((Entity) (this)), "random.fizz", 0.4F, 2.0F + W.nextFloat() * 0.4F); + } + g(p, q, r); + c(s, t, u); + float f1 = 0.98F; + + if (A) { + f1 = 0.5880001F; + int i = l.a(MathHelper.b(p), MathHelper.b(z.b) - 1, MathHelper.b(r)); + + if (i > 0) { + f1 = Block.m[i].bu * 0.98F; + } + } + s *= f1; + t *= 0.98000001907348633D; + u *= f1; + if (A) { + t *= -0.5D; + } + e++; + b++; + if (b >= 6000) { + q(); + } + } + + public boolean v() { + return l.a(z, Material.f, ((Entity) (this))); + } + + private boolean g(double d1, double d2, double d3) { + int i = MathHelper.b(d1); + int j = MathHelper.b(d2); + int k = MathHelper.b(d3); + double d4 = d1 - (double) i; + double d5 = d2 - (double) j; + double d6 = d3 - (double) k; + + if (Block.o[l.a(i, j, k)]) { + boolean flag = !Block.o[l.a(i - 1, j, k)]; + boolean flag1 = !Block.o[l.a(i + 1, j, k)]; + boolean flag2 = !Block.o[l.a(i, j - 1, k)]; + boolean flag3 = !Block.o[l.a(i, j + 1, k)]; + boolean flag4 = !Block.o[l.a(i, j, k - 1)]; + boolean flag5 = !Block.o[l.a(i, j, k + 1)]; + byte byte0 = -1; + double d7 = 9999D; + + if (flag && d4 < d7) { + d7 = d4; + byte0 = 0; + } + if (flag1 && 1.0D - d4 < d7) { + d7 = 1.0D - d4; + byte0 = 1; + } + if (flag2 && d5 < d7) { + d7 = d5; + byte0 = 2; + } + if (flag3 && 1.0D - d5 < d7) { + d7 = 1.0D - d5; + byte0 = 3; + } + if (flag4 && d6 < d7) { + d7 = d6; + byte0 = 4; + } + if (flag5 && 1.0D - d6 < d7) { + double d8 = 1.0D - d6; + + byte0 = 5; + } + float f1 = W.nextFloat() * 0.2F + 0.1F; + + if (byte0 == 0) { + s = -f1; + } + if (byte0 == 1) { + s = f1; + } + if (byte0 == 2) { + t = -f1; + } + if (byte0 == 3) { + t = f1; + } + if (byte0 == 4) { + u = -f1; + } + if (byte0 == 5) { + u = f1; + } + } + return false; + } + + protected void b(int i) { + a(((Entity) (null)), i); + } + + public boolean a(Entity entity, int i) { + y(); + f -= i; + if (f <= 0) { + q(); + } + return false; + } + + public void a(NBTTagCompound nbttagcompound) { + nbttagcompound.a("Health", (byte) f); + nbttagcompound.a("Age", (short) b); + nbttagcompound.a("Item", a.a(new NBTTagCompound())); + } + + public void b(NBTTagCompound nbttagcompound) { + f = nbttagcompound.c("Health") & 0xff; + b = ((int) (nbttagcompound.c("Age"))); + NBTTagCompound nbttagcompound1 = nbttagcompound.j("Item"); + + a = new ItemStack(nbttagcompound1); + } + + public void b(EntityPlayer entityplayer) { + if (l.z) { + return; + } + int i = a.a; + + if (c == 0 && entityplayer.an.a(a)) { + l.a(((Entity) (this)), "random.pop", 0.2F, ((W.nextFloat() - W.nextFloat()) * 0.7F + 1.0F) * 2.0F); + entityplayer.c(((Entity) (this)), i); + q(); + } + } +} diff --git a/src/main/java/net/minecraft/server/EntityList.java b/src/main/java/net/minecraft/server/EntityList.java new file mode 100644 index 00000000..1602769b --- /dev/null +++ b/src/main/java/net/minecraft/server/EntityList.java @@ -0,0 +1,100 @@ +package net.minecraft.server; + +import java.io.PrintStream; +import java.lang.reflect.Constructor; +import java.util.HashMap; +import java.util.Map; + +public class EntityList { + + private static Map a = new HashMap(); + private static Map b = new HashMap(); + private static Map c = new HashMap(); + private static Map d = new HashMap(); + + public EntityList() {} + + private static void a(Class class1, String s, int i) { + a.put(((s)), ((class1))); + b.put(((class1)), ((s))); + c.put(((Integer.valueOf(i))), ((class1))); + d.put(((class1)), ((Integer.valueOf(i)))); + } + + public static Entity a(String s, World world) { + Entity entity = null; + + try { + Class class1 = (Class) a.get(((s))); + + if (class1 != null) { + entity = (Entity) class1.getConstructor(new Class[] { + net.minecraft.server.World.class + }).newInstance(new Object[] { + world + }); + } + } catch (Exception exception) { + exception.printStackTrace(); + } + return entity; + } + + public static Entity a(NBTTagCompound nbttagcompound, World world) { + Entity entity = null; + + try { + Class class1 = (Class) a.get(((nbttagcompound.h("id")))); + + if (class1 != null) { + entity = (Entity) class1.getConstructor(new Class[] { + net.minecraft.server.World.class + }).newInstance(new Object[] { + world + }); + } + } catch (Exception exception) { + exception.printStackTrace(); + } + if (entity != null) { + entity.e(nbttagcompound); + } else { + System.out.println((new StringBuilder()).append("Skipping Entity with id ").append(nbttagcompound.h("id")).toString()); + } + return entity; + } + + public static int a(Entity entity) { + return ((Integer) d.get(((((entity)).getClass())))).intValue(); + } + + public static String b(Entity entity) { + return (String) b.get(((((entity)).getClass()))); + } + + static { + a(net.minecraft.server.EntityArrow.class, "Arrow", 10); + a(net.minecraft.server.EntitySnowball.class, "Snowball", 11); + a(net.minecraft.server.EntityItem.class, "Item", 1); + a(net.minecraft.server.EntityPainting.class, "Painting", 9); + a(net.minecraft.server.EntityLiving.class, "Mob", 48); + a(net.minecraft.server.EntityMobs.class, "Monster", 49); + a(net.minecraft.server.EntityCreeper.class, "Creeper", 50); + a(net.minecraft.server.EntitySkeleton.class, "Skeleton", 51); + a(net.minecraft.server.EntitySpider.class, "Spider", 52); + a(net.minecraft.server.EntityZombieSimple.class, "Giant", 53); + a(net.minecraft.server.EntityZombie.class, "Zombie", 54); + a(net.minecraft.server.EntitySlime.class, "Slime", 55); + a(net.minecraft.server.EntityGhast.class, "Ghast", 56); + a(net.minecraft.server.EntityPigZombie.class, "PigZombie", 57); + a(net.minecraft.server.EntityPig.class, "Pig", 90); + a(net.minecraft.server.EntitySheep.class, "Sheep", 91); + a(net.minecraft.server.EntityCow.class, "Cow", 92); + a(net.minecraft.server.EntityChicken.class, "Chicken", 93); + a(net.minecraft.server.EntitySquid.class, "Squid", 94); + a(net.minecraft.server.EntityTNTPrimed.class, "PrimedTnt", 20); + a(net.minecraft.server.EntityFallingSand.class, "FallingSand", 21); + a(net.minecraft.server.EntityMinecart.class, "Minecart", 40); + a(net.minecraft.server.EntityBoat.class, "Boat", 41); + } +} diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java new file mode 100644 index 00000000..76cc6b5c --- /dev/null +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +1,723 @@ +package net.minecraft.server; + +import java.util.List; +import java.util.Random; + +public abstract class EntityLiving extends Entity { + + public int aF; + public float aG; + public float aH; + public float aI; + public float aJ; + protected float aK; + protected float aL; + protected float aM; + protected float aN; + protected boolean aO; + protected String aP; + protected boolean aQ; + protected float aR; + protected String aS; + protected float aT; + protected int aU; + protected float aV; + public boolean aW; + public float aX; + public float aY; + public int aZ; + public int ba; + private int a; + public int bb; + public int bc; + public float bd; + public int be; + public int bf; + public float bg; + public float bh; + protected boolean bi; + public int bj; + public float bk; + public float bl; + public float bm; + public float bn; + protected int bo; + protected double bp; + protected double bq; + protected double br; + protected double bs; + protected double bt; + float bu; + protected int bv; + protected int bw; + protected float bx; + protected float by; + protected float bz; + protected boolean bA; + protected float bB; + protected float bC; + private Entity b; + private int c; + + public EntityLiving(World world) { + super(world); + aF = 20; + aI = 0.0F; + aJ = 0.0F; + aO = true; + aP = "/mob/char.png"; + aQ = true; + aR = 0.0F; + aS = null; + aT = 1.0F; + aU = 0; + aV = 0.0F; + aW = false; + bd = 0.0F; + be = 0; + bf = 0; + bi = false; + bj = -1; + bk = (float) (Math.random() * 0.89999997615814209D + 0.10000000149011612D); + bu = 0.0F; + bv = 0; + bw = 0; + bA = false; + bB = 0.0F; + bC = 0.7F; + c = 0; + aZ = 10; + i = true; + aH = (float) (Math.random() + 1.0D) * 0.01F; + a(p, q, r); + aG = (float) Math.random() * 12398F; + v = (float) (Math.random() * 3.1415927410125732D * 2D); + S = 0.5F; + } + + protected void a() {} + + public boolean i(Entity entity) { + return l.a(Vec3D.b(p, q + (double) w(), r), Vec3D.b(entity.p, entity.q + (double) entity.w(), entity.r)) == null; + } + + public boolean c_() { + return !G; + } + + public boolean z() { + return !G; + } + + public float w() { + return J * 0.85F; + } + + public int c() { + return 80; + } + + public void r() { + aX = aY; + super.r(); + if (W.nextInt(1000) < a++) { + a = -c(); + String s = e(); + + if (s != null) { + this.l.a(((Entity) (this)), s, i(), (W.nextFloat() - W.nextFloat()) * 0.2F + 1.0F); + } + } + if (B() && C()) { + a(((Entity) (null)), 1); + } + if (ae || this.l.z) { + Z = 0; + } + if (B() && a(Material.f) && !d_()) { + ad--; + if (ad == -20) { + ad = 0; + for (int k = 0; k < 8; k++) { + float f1 = W.nextFloat() - W.nextFloat(); + float f2 = W.nextFloat() - W.nextFloat(); + float f3 = W.nextFloat() - W.nextFloat(); + + this.l.a("bubble", p + (double) f1, q + (double) f2, r + (double) f3, this.s, t, u); + } + + a(((Entity) (null)), 2); + } + Z = 0; + } else { + ad = aa; + } + bg = bh; + if (bf > 0) { + bf--; + } + if (bb > 0) { + bb--; + } + if (ac > 0) { + ac--; + } + if (aZ <= 0) { + be++; + if (be > 20) { + T(); + q(); + for (int l = 0; l < 20; l++) { + double d1 = W.nextGaussian() * 0.02D; + double d2 = W.nextGaussian() * 0.02D; + double d3 = W.nextGaussian() * 0.02D; + + this.l.a("explode", (p + (double) (W.nextFloat() * I * 2.0F)) - (double) I, q + (double) (W.nextFloat() * J), (r + (double) (W.nextFloat() * I * 2.0F)) - (double) I, d1, d2, d3); + } + } + } + aN = aM; + aJ = aI; + x = v; + y = w; + } + + public void R() { + for (int k = 0; k < 20; k++) { + double d1 = W.nextGaussian() * 0.02D; + double d2 = W.nextGaussian() * 0.02D; + double d3 = W.nextGaussian() * 0.02D; + double d4 = 10D; + + l.a("explode", (p + (double) (W.nextFloat() * I * 2.0F)) - (double) I - d1 * d4, (q + (double) (W.nextFloat() * J)) - d2 * d4, (r + (double) (W.nextFloat() * I * 2.0F)) - (double) I - d3 * d4, d1, d2, d3); + } + } + + public void D() { + super.D(); + aK = aL; + aL = 0.0F; + } + + public void b_() { + super.b_(); + o(); + double d1 = p - m; + double d2 = r - o; + float f1 = MathHelper.a(d1 * d1 + d2 * d2); + float f2 = aI; + float f3 = 0.0F; + + aK = aL; + float f4 = 0.0F; + + if (f1 > 0.05F) { + f4 = 1.0F; + f3 = f1 * 3F; + f2 = ((float) Math.atan2(d2, d1) * 180F) / 3.141593F - 90F; + } + if (aY > 0.0F) { + f2 = v; + } + if (!A) { + f4 = 0.0F; + } + aL = aL + (f4 - aL) * 0.3F; + float f5; + + for (f5 = f2 - aI; f5 < -180F; f5 += 360F) { + ; + } + for (; f5 >= 180F; f5 -= 360F) { + ; + } + aI += f5 * 0.3F; + float f6; + + for (f6 = v - aI; f6 < -180F; f6 += 360F) { + ; + } + for (; f6 >= 180F; f6 -= 360F) { + ; + } + boolean flag = f6 < -90F || f6 >= 90F; + + if (f6 < -75F) { + f6 = -75F; + } + if (f6 >= 75F) { + f6 = 75F; + } + aI = v - f6; + if (f6 * f6 > 2500F) { + aI += f6 * 0.2F; + } + if (flag) { + f3 *= -1F; + } + for (; v - x < -180F; x -= 360F) { + ; + } + for (; v - x >= 180F; x += 360F) { + ; + } + for (; aI - aJ < -180F; aJ -= 360F) { + ; + } + for (; aI - aJ >= 180F; aJ += 360F) { + ; + } + for (; w - y < -180F; y -= 360F) { + ; + } + for (; w - y >= 180F; y += 360F) { + ; + } + aM += f3; + } + + protected void a(float f1, float f2) { + super.a(f1, f2); + } + + public void d(int k) { + if (aZ <= 0) { + return; + } + aZ += k; + if (aZ > 20) { + aZ = 20; + } + ac = aF / 2; + } + + public boolean a(Entity entity, int k) { + if (l.z) { + return false; + } + bw = 0; + if (aZ <= 0) { + return false; + } + bm = 1.5F; + boolean flag = true; + + if ((float) ac > (float) aF / 2.0F) { + if (k <= bv) { + return false; + } + e(k - bv); + bv = k; + flag = false; + } else { + bv = k; + ba = aZ; + ac = aF; + e(k); + bb = bc = 10; + } + bd = 0.0F; + if (flag) { + l.a(((Entity) (this)), (byte) 2); + y(); + if (entity != null) { + double d1 = entity.p - p; + double d2; + + for (d2 = entity.r - r; d1 * d1 + d2 * d2 < 0.0001D; d2 = (Math.random() - Math.random()) * 0.01D) { + d1 = (Math.random() - Math.random()) * 0.01D; + } + + bd = (float) ((Math.atan2(d2, d1) * 180D) / 3.1415927410125732D) - v; + a(entity, k, d1, d2); + } else { + bd = (int) (Math.random() * 2D) * 180; + } + } + if (aZ <= 0) { + if (flag) { + l.a(((Entity) (this)), g(), i(), (W.nextFloat() - W.nextFloat()) * 0.2F + 1.0F); + } + f(entity); + } else if (flag) { + l.a(((Entity) (this)), f(), i(), (W.nextFloat() - W.nextFloat()) * 0.2F + 1.0F); + } + return true; + } + + protected void e(int k) { + aZ -= k; + } + + protected float i() { + return 1.0F; + } + + protected String e() { + return null; + } + + protected String f() { + return "random.hurt"; + } + + protected String g() { + return "random.hurt"; + } + + public void a(Entity entity, int k, double d1, double d2) { + float f1 = MathHelper.a(d1 * d1 + d2 * d2); + float f2 = 0.4F; + + s /= 2D; + t /= 2D; + u /= 2D; + s -= (d1 / (double) f1) * (double) f2; + t += 0.40000000596046448D; + u -= (d2 / (double) f1) * (double) f2; + if (t > 0.40000000596046448D) { + t = 0.40000000596046448D; + } + } + + public void f(Entity entity) { + if (aU > 0 && entity != null) { + entity.b(((Entity) (this)), aU); + } + bi = true; + if (!l.z) { + g_(); + } + l.a(((Entity) (this)), (byte) 3); + } + + protected void g_() { + int k = h(); + + if (k > 0) { + int l = W.nextInt(3); + + for (int i1 = 0; i1 < l; i1++) { + a(k, 1); + } + } + } + + protected int h() { + return 0; + } + + protected void a(float f1) { + int k = (int) Math.ceil(f1 - 3F); + + if (k > 0) { + a(((Entity) (null)), k); + int l = this.l.a(MathHelper.b(p), MathHelper.b(q - 0.20000000298023224D - (double) H), MathHelper.b(r)); + + if (l > 0) { + StepSound stepsound = Block.m[l].br; + + this.l.a(((Entity) (this)), stepsound.c(), stepsound.a() * 0.5F, stepsound.b() * 0.75F); + } + } + } + + public void c(float f1, float f2) { + if (v()) { + double d1 = q; + + a(f1, f2, 0.02F); + c(s, t, u); + s *= 0.80000001192092896D; + t *= 0.80000001192092896D; + u *= 0.80000001192092896D; + t -= 0.02D; + if (B && b(s, ((t + 0.60000002384185791D) - q) + d1, u)) { + t = 0.30000001192092896D; + } + } else if (x()) { + double d2 = q; + + a(f1, f2, 0.02F); + c(s, t, u); + s *= 0.5D; + t *= 0.5D; + u *= 0.5D; + t -= 0.02D; + if (B && b(s, ((t + 0.60000002384185791D) - q) + d2, u)) { + t = 0.30000001192092896D; + } + } else { + float f3 = 0.91F; + + if (A) { + f3 = 0.5460001F; + int k = this.l.a(MathHelper.b(p), MathHelper.b(z.b) - 1, MathHelper.b(r)); + + if (k > 0) { + f3 = Block.m[k].bu * 0.91F; + } + } + float f4 = 0.1627714F / (f3 * f3 * f3); + + a(f1, f2, A ? 0.1F * f4 : 0.02F); + f3 = 0.91F; + if (A) { + f3 = 0.5460001F; + int l = this.l.a(MathHelper.b(p), MathHelper.b(z.b) - 1, MathHelper.b(r)); + + if (l > 0) { + f3 = Block.m[l].bu * 0.91F; + } + } + if (m()) { + N = 0.0F; + if (t < -0.14999999999999999D) { + t = -0.14999999999999999D; + } + } + c(s, t, u); + if (B && m()) { + t = 0.20000000000000001D; + } + t -= 0.080000000000000002D; + t *= 0.98000001907348633D; + s *= f3; + u *= f3; + } + bl = bm; + double d3 = p - m; + double d4 = r - o; + float f5 = MathHelper.a(d3 * d3 + d4 * d4) * 4F; + + if (f5 > 1.0F) { + f5 = 1.0F; + } + bm += (f5 - bm) * 0.4F; + bn += bm; + } + + public boolean m() { + int k = MathHelper.b(p); + int l = MathHelper.b(z.b); + int i1 = MathHelper.b(r); + + return this.l.a(k, l, i1) == Block.aF.bi || this.l.a(k, l + 1, i1) == Block.aF.bi; + } + + public void a(NBTTagCompound nbttagcompound) { + nbttagcompound.a("Health", (short) aZ); + nbttagcompound.a("HurtTime", (short) bb); + nbttagcompound.a("DeathTime", (short) be); + nbttagcompound.a("AttackTime", (short) bf); + } + + public void b(NBTTagCompound nbttagcompound) { + aZ = ((int) (nbttagcompound.c("Health"))); + if (!nbttagcompound.a("Health")) { + aZ = 10; + } + bb = ((int) (nbttagcompound.c("HurtTime"))); + be = ((int) (nbttagcompound.c("DeathTime"))); + bf = ((int) (nbttagcompound.c("AttackTime"))); + } + + public boolean B() { + return !G && aZ > 0; + } + + public boolean d_() { + return false; + } + + public void o() { + if (bo > 0) { + double d1 = p + (bp - p) / (double) bo; + double d2 = q + (bq - q) / (double) bo; + double d3 = r + (br - r) / (double) bo; + double d4; + + for (d4 = bs - (double) v; d4 < -180D; d4 += 360D) { + ; + } + for (; d4 >= 180D; d4 -= 360D) { + ; + } + v += ((float) (d4 / (double) bo)); + w += ((float) ((bt - (double) w) / (double) bo)); + bo--; + a(d1, d2, d3); + b(v, w); + } + if (aZ <= 0) { + bA = false; + bx = 0.0F; + by = 0.0F; + bz = 0.0F; + } else if (!aW) { + d(); + } + boolean flag = v(); + boolean flag1 = x(); + + if (bA) { + if (flag) { + t += 0.039999999105930328D; + } else if (flag1) { + t += 0.039999999105930328D; + } else if (A) { + S(); + } + } + bx *= 0.98F; + by *= 0.98F; + bz *= 0.9F; + c(bx, by); + List list = l.b(((Entity) (this)), z.b(0.20000000298023224D, 0.0D, 0.20000000298023224D)); + + if (list != null && list.size() > 0) { + for (int k = 0; k < list.size(); k++) { + Entity entity = (Entity) list.get(k); + + if (entity.z()) { + entity.c(((Entity) (this))); + } + } + } + } + + protected void S() { + t = 0.41999998688697815D; + } + + protected void d() { + bw++; + EntityPlayer entityplayer = l.a(((Entity) (this)), -1D); + + if (entityplayer != null) { + double d1 = ((Entity) (entityplayer)).p - p; + double d2 = ((Entity) (entityplayer)).q - q; + double d3 = ((Entity) (entityplayer)).r - r; + double d4 = d1 * d1 + d2 * d2 + d3 * d3; + + if (d4 > 16384D) { + q(); + } + if (bw > 600 && W.nextInt(800) == 0) { + if (d4 < 1024D) { + bw = 0; + } else { + q(); + } + } + } + bx = 0.0F; + by = 0.0F; + float f1 = 8F; + + if (W.nextFloat() < 0.02F) { + EntityPlayer entityplayer1 = l.a(((Entity) (this)), f1); + + if (entityplayer1 != null) { + b = ((Entity) (entityplayer1)); + c = 10 + W.nextInt(20); + } else { + bz = (W.nextFloat() - 0.5F) * 20F; + } + } + if (b != null) { + b(b, 10F); + if (c-- <= 0 || b.G || b.b(((Entity) (this))) > (double) (f1 * f1)) { + b = null; + } + } else { + if (W.nextFloat() < 0.05F) { + bz = (W.nextFloat() - 0.5F) * 20F; + } + v += bz; + w = bB; + } + boolean flag = v(); + boolean flag1 = x(); + + if (flag || flag1) { + bA = W.nextFloat() < 0.8F; + } + } + + public void b(Entity entity, float f1) { + double d1 = entity.p - p; + double d2 = entity.r - r; + double d3; + + if (entity instanceof EntityLiving) { + EntityLiving entityliving = (EntityLiving) entity; + + d3 = (entityliving.q + (double) entityliving.w()) - (q + (double) w()); + } else { + d3 = (entity.z.b + entity.z.e) / 2D - (q + (double) w()); + } + double d4 = MathHelper.a(d1 * d1 + d2 * d2); + float f2 = (float) ((Math.atan2(d2, d1) * 180D) / 3.1415927410125732D) - 90F; + float f3 = (float) ((Math.atan2(d3, d4) * 180D) / 3.1415927410125732D); + + w = -b(w, f3, f1); + v = b(v, f2, f1); + } + + private float b(float f1, float f2, float f3) { + float f4; + + for (f4 = f2 - f1; f4 < -180F; f4 += 360F) { + ; + } + for (; f4 >= 180F; f4 -= 360F) { + ; + } + if (f4 > f3) { + f4 = f3; + } + if (f4 < -f3) { + f4 = -f3; + } + return f1 + f4; + } + + public void T() {} + + public boolean b() { + return l.a(z) && l.a(((Entity) (this)), z).size() == 0 && !l.b(z); + } + + protected void t() { + a(((Entity) (null)), 4); + } + + public Vec3D G() { + return c(1.0F); + } + + public Vec3D c(float f1) { + if (f1 == 1.0F) { + float f2 = MathHelper.b(-v * 0.01745329F - 3.141593F); + float f4 = MathHelper.a(-v * 0.01745329F - 3.141593F); + float f6 = -MathHelper.b(-w * 0.01745329F); + float f8 = MathHelper.a(-w * 0.01745329F); + + return Vec3D.b(f4 * f6, f8, f2 * f6); + } else { + float f3 = y + (w - y) * f1; + float f5 = x + (v - x) * f1; + float f7 = MathHelper.b(-f5 * 0.01745329F - 3.141593F); + float f9 = MathHelper.a(-f5 * 0.01745329F - 3.141593F); + float f10 = -MathHelper.b(-f3 * 0.01745329F); + float f11 = MathHelper.a(-f3 * 0.01745329F); + + return Vec3D.b(f9 * f10, f11, f7 * f10); + } + } + + public int j() { + return 4; + } +} diff --git a/src/main/java/net/minecraft/server/EntityPainting.java b/src/main/java/net/minecraft/server/EntityPainting.java new file mode 100644 index 00000000..3d59a8fc --- /dev/null +++ b/src/main/java/net/minecraft/server/EntityPainting.java @@ -0,0 +1,209 @@ +package net.minecraft.server; + +import java.util.*; + +public class EntityPainting extends Entity { + + private int f; + public int a; + public int b; + public int c; + public int d; + public EnumArt e; + + public EntityPainting(World world) { + super(world); + f = 0; + a = 0; + H = 0.0F; + a(0.5F, 0.5F); + } + + public EntityPainting(World world, int i, int j, int k, int l) { + this(world); + b = i; + c = j; + d = k; + ArrayList arraylist = new ArrayList(); + EnumArt aenumart[] = EnumArt.values(); + int i1 = aenumart.length; + + for (int j1 = 0; j1 < i1; j1++) { + EnumArt enumart = aenumart[j1]; + + e = enumart; + a(l); + if (d()) { + ((List) (arraylist)).add(((enumart))); + } + } + + if (((List) (arraylist)).size() > 0) { + e = (EnumArt) ((List) (arraylist)).get(W.nextInt(((List) (arraylist)).size())); + } + a(l); + } + + protected void a() {} + + public void a(int i) { + a = i; + x = v = i * 90; + float f1 = e.A; + float f2 = e.B; + float f3 = e.A; + + if (i == 0 || i == 2) { + f3 = 0.5F; + } else { + f1 = 0.5F; + } + f1 /= 32F; + f2 /= 32F; + f3 /= 32F; + float f4 = (float) b + 0.5F; + float f5 = (float) c + 0.5F; + float f6 = (float) d + 0.5F; + float f7 = 0.5625F; + + if (i == 0) { + f6 -= f7; + } + if (i == 1) { + f4 -= f7; + } + if (i == 2) { + f6 += f7; + } + if (i == 3) { + f4 += f7; + } + if (i == 0) { + f4 -= d(e.A); + } + if (i == 1) { + f6 += d(e.A); + } + if (i == 2) { + f4 += d(e.A); + } + if (i == 3) { + f6 -= d(e.A); + } + f5 += d(e.B); + a(f4, f5, f6); + float f8 = -0.00625F; + + z.c(f4 - f1 - f8, f5 - f2 - f8, f6 - f3 - f8, f4 + f1 + f8, f5 + f2 + f8, f6 + f3 + f8); + } + + private float d(int i) { + if (i == 32) { + return 0.5F; + } + return i != 64 ? 0.0F : 0.5F; + } + + public void b_() { + if (f++ == 100 && !l.z) { + f = 0; + if (!d()) { + q(); + l.a(((Entity) (new EntityItem(l, p, q, r, new ItemStack(Item.aq))))); + } + } + } + + public boolean d() { + if (this.l.a(((Entity) (this)), z).size() > 0) { + return false; + } + int i = e.A / 16; + int j = e.B / 16; + int k = b; + int l = c; + int i1 = d; + + if (a == 0) { + k = MathHelper.b(p - (double) ((float) e.A / 32F)); + } + if (a == 1) { + i1 = MathHelper.b(r - (double) ((float) e.A / 32F)); + } + if (a == 2) { + k = MathHelper.b(p - (double) ((float) e.A / 32F)); + } + if (a == 3) { + i1 = MathHelper.b(r - (double) ((float) e.A / 32F)); + } + l = MathHelper.b(q - (double) ((float) e.B / 32F)); + for (int j1 = 0; j1 < i; j1++) { + for (int k1 = 0; k1 < j; k1++) { + Material material; + + if (a == 0 || a == 2) { + material = this.l.c(k + j1, l + k1, d); + } else { + material = this.l.c(b, l + k1, i1 + j1); + } + if (!material.a()) { + return false; + } + } + } + + List list = this.l.b(((Entity) (this)), z); + + for (int l1 = 0; l1 < list.size(); l1++) { + if (list.get(l1) instanceof EntityPainting) { + return false; + } + } + + return true; + } + + public boolean c_() { + return true; + } + + public boolean a(Entity entity, int i) { + if (!G && !l.z) { + q(); + y(); + l.a(((Entity) (new EntityItem(l, p, q, r, new ItemStack(Item.aq))))); + } + return true; + } + + public void a(NBTTagCompound nbttagcompound) { + nbttagcompound.a("Dir", (byte) a); + nbttagcompound.a("Motive", e.z); + nbttagcompound.a("TileX", b); + nbttagcompound.a("TileY", c); + nbttagcompound.a("TileZ", d); + } + + public void b(NBTTagCompound nbttagcompound) { + a = ((int) (nbttagcompound.b("Dir"))); + b = nbttagcompound.d("TileX"); + c = nbttagcompound.d("TileY"); + d = nbttagcompound.d("TileZ"); + String s = nbttagcompound.h("Motive"); + EnumArt aenumart[] = EnumArt.values(); + int i = aenumart.length; + + for (int j = 0; j < i; j++) { + EnumArt enumart = aenumart[j]; + + if (enumart.z.equals(((s)))) { + e = enumart; + } + } + + if (e == null) { + e = EnumArt.a; + } + a(a); + } +} diff --git a/src/main/java/net/minecraft/server/EntityPig.java b/src/main/java/net/minecraft/server/EntityPig.java new file mode 100644 index 00000000..e44e7a60 --- /dev/null +++ b/src/main/java/net/minecraft/server/EntityPig.java @@ -0,0 +1,61 @@ +package net.minecraft.server; + +public class EntityPig extends EntityAnimals { + + public EntityPig(World world) { + super(world); + aP = "/mob/pig.png"; + a(0.9F, 0.9F); + } + + protected void a() { + af.a(16, ((Byte.valueOf((byte) 0)))); + } + + public void a(NBTTagCompound nbttagcompound) { + super.a(nbttagcompound); + nbttagcompound.a("Saddle", K()); + } + + public void b(NBTTagCompound nbttagcompound) { + super.b(nbttagcompound); + a(nbttagcompound.l("Saddle")); + } + + protected String e() { + return "mob.pig"; + } + + protected String f() { + return "mob.pig"; + } + + protected String g() { + return "mob.pigdeath"; + } + + public boolean a(EntityPlayer entityplayer) { + if (K() && !l.z && (j == null || j == entityplayer)) { + entityplayer.e(((Entity) (this))); + return true; + } else { + return false; + } + } + + protected int h() { + return Item.ao.ba; + } + + public boolean K() { + return (af.a(16) & 1) != 0; + } + + public void a(boolean flag) { + if (flag) { + af.b(16, ((Byte.valueOf((byte) 1)))); + } else { + af.b(16, ((Byte.valueOf((byte) 0)))); + } + } +} diff --git a/src/main/java/net/minecraft/server/EntityPigZombie.java b/src/main/java/net/minecraft/server/EntityPigZombie.java new file mode 100644 index 00000000..d29de54a --- /dev/null +++ b/src/main/java/net/minecraft/server/EntityPigZombie.java @@ -0,0 +1,100 @@ +package net.minecraft.server; + +import java.util.List; +import java.util.Random; + +public class EntityPigZombie extends EntityZombie { + + private int a; + private int b; + private static final ItemStack f; + + public EntityPigZombie(World world) { + super(world); + a = 0; + b = 0; + aP = "/mob/pigzombie.png"; + bC = 0.5F; + c = 5; + ae = true; + } + + public void b_() { + bC = d == null ? 0.5F : 0.95F; + if (b > 0 && --b == 0) { + l.a(((Entity) (this)), "mob.zombiepig.zpigangry", i() * 2.0F, ((W.nextFloat() - W.nextFloat()) * 0.2F + 1.0F) * 1.8F); + } + super.b_(); + } + + public boolean b() { + return l.k > 0 && l.a(z) && l.a(((Entity) (this)), z).size() == 0 && !l.b(z); + } + + public void a(NBTTagCompound nbttagcompound) { + super.a(nbttagcompound); + nbttagcompound.a("Anger", (short) a); + } + + public void b(NBTTagCompound nbttagcompound) { + super.b(nbttagcompound); + a = ((int) (nbttagcompound.c("Anger"))); + } + + protected Entity l() { + if (a == 0) { + return null; + } else { + return super.l(); + } + } + + public void o() { + super.o(); + } + + public boolean a(Entity entity, int i) { + if (entity instanceof EntityPlayer) { + List list = l.b(((Entity) (this)), z.b(32D, 32D, 32D)); + + for (int j = 0; j < list.size(); j++) { + Entity entity1 = (Entity) list.get(j); + + if (entity1 instanceof EntityPigZombie) { + EntityPigZombie entitypigzombie = (EntityPigZombie) entity1; + + entitypigzombie.g(entity); + } + } + + g(entity); + } + return super.a(entity, i); + } + + private void g(Entity entity) { + d = entity; + a = 400 + W.nextInt(400); + b = W.nextInt(40); + } + + protected String e() { + return "mob.zombiepig.zpig"; + } + + protected String f() { + return "mob.zombiepig.zpighurt"; + } + + protected String g() { + return "mob.zombiepig.zpigdeath"; + } + + protected int h() { + return Item.ap.ba; + } + + static { + f = new ItemStack(Item.E, 1); + } +} diff --git a/src/main/java/net/minecraft/server/EntitySheep.java b/src/main/java/net/minecraft/server/EntitySheep.java new file mode 100644 index 00000000..dcb02d90 --- /dev/null +++ b/src/main/java/net/minecraft/server/EntitySheep.java @@ -0,0 +1,129 @@ +package net.minecraft.server; + +import java.util.Random; + +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 EntitySheep(World world) { + super(world); + aP = "/mob/sheep.png"; + a(0.9F, 1.3F); + } + + protected void a() { + super.a(); + af.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); + + for (int k = 0; k < j; k++) { + EntityItem entityitem = a(new ItemStack(Block.ab.bi, 1, 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; + } + } + return super.a(entity, i); + } + + public void a(NBTTagCompound nbttagcompound) { + super.a(nbttagcompound); + nbttagcompound.a("Sheared", f_()); + nbttagcompound.a("Color", (byte) e_()); + } + + public void b(NBTTagCompound nbttagcompound) { + super.b(nbttagcompound); + a(nbttagcompound.l("Sheared")); + a(((int) (nbttagcompound.b("Color")))); + } + + protected String e() { + return "mob.sheep"; + } + + protected String f() { + return "mob.sheep"; + } + + protected String g() { + return "mob.sheep"; + } + + public int e_() { + return af.a(16) & 0xf; + } + + public void a(int i) { + byte byte0 = af.a(16); + + af.b(16, ((Byte.valueOf((byte) (byte0 & 0xf0 | i & 0xf))))); + } + + public boolean f_() { + return (af.a(16) & 0x10) != 0; + } + + public void a(boolean flag) { + byte byte0 = af.a(16); + + if (flag) { + af.b(16, ((Byte.valueOf((byte) (byte0 | 0x10))))); + } else { + af.b(16, ((Byte.valueOf((byte) (byte0 & 0xffffffef))))); + } + } + + 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; + } +} diff --git a/src/main/java/net/minecraft/server/EntitySlime.java b/src/main/java/net/minecraft/server/EntitySlime.java new file mode 100644 index 00000000..d2aa403d --- /dev/null +++ b/src/main/java/net/minecraft/server/EntitySlime.java @@ -0,0 +1,135 @@ +package net.minecraft.server; + +import java.util.Random; + +public class EntitySlime extends EntityLiving implements IMobs { + + public float a; + public float b; + private int d; + public int c; + + public EntitySlime(World world) { + super(world); + d = 0; + c = 1; + aP = "/mob/slime.png"; + c = 1 << W.nextInt(3); + H = 0.0F; + d = W.nextInt(20) + 10; + a(c); + } + + public void a(int j) { + c = j; + a(0.6F * (float) j, 0.6F * (float) j); + aZ = j * j; + a(p, q, r); + } + + public void a(NBTTagCompound nbttagcompound) { + super.a(nbttagcompound); + nbttagcompound.a("Size", c - 1); + } + + public void b(NBTTagCompound nbttagcompound) { + super.b(nbttagcompound); + c = nbttagcompound.d("Size") + 1; + } + + public void b_() { + b = a; + boolean flag = A; + + super.b_(); + if (A && !flag) { + for (int j = 0; j < c * 8; j++) { + float f1 = W.nextFloat() * 3.141593F * 2.0F; + float f2 = W.nextFloat() * 0.5F + 0.5F; + float f3 = MathHelper.a(f1) * (float) c * 0.5F * f2; + float f4 = MathHelper.b(f1) * (float) c * 0.5F * f2; + + l.a("slime", p + (double) f3, z.b, r + (double) f4, 0.0D, 0.0D, 0.0D); + } + + if (c > 2) { + l.a(((Entity) (this)), "mob.slime", i(), ((W.nextFloat() - W.nextFloat()) * 0.2F + 1.0F) / 0.8F); + } + a = -0.5F; + } + a = a * 0.6F; + } + + protected void d() { + EntityPlayer entityplayer = l.a(((Entity) (this)), 16D); + + if (entityplayer != null) { + b(((Entity) (entityplayer)), 10F); + } + if (A && d-- <= 0) { + d = W.nextInt(20) + 10; + if (entityplayer != null) { + d /= 3; + } + bA = true; + if (c > 1) { + l.a(((Entity) (this)), "mob.slime", i(), ((W.nextFloat() - W.nextFloat()) * 0.2F + 1.0F) * 0.8F); + } + a = 1.0F; + bx = 1.0F - W.nextFloat() * 2.0F; + by = 1 * c; + } else { + bA = false; + if (A) { + bx = by = 0.0F; + } + } + } + + public void q() { + if (c > 1 && aZ == 0) { + for (int j = 0; j < 4; j++) { + float f1 = (((float) (j % 2) - 0.5F) * (float) c) / 4F; + float f2 = (((float) (j / 2) - 0.5F) * (float) c) / 4F; + EntitySlime entityslime = new EntitySlime(l); + + entityslime.a(c / 2); + entityslime.c(p + (double) f1, q + 0.5D, r + (double) f2, W.nextFloat() * 360F, 0.0F); + l.a(((Entity) (entityslime))); + } + } + super.q(); + } + + public void b(EntityPlayer entityplayer) { + if (c > 1 && i(((Entity) (entityplayer))) && (double) a(((Entity) (entityplayer))) < 0.59999999999999998D * (double) c && entityplayer.a(((Entity) (this)), c)) { + l.a(((Entity) (this)), "mob.slimeattack", 1.0F, (W.nextFloat() - W.nextFloat()) * 0.2F + 1.0F); + } + } + + protected String f() { + return "mob.slime"; + } + + protected String g() { + return "mob.slime"; + } + + protected int h() { + if (c == 1) { + return Item.aK.ba; + } else { + return 0; + } + } + + public boolean b() { + Chunk chunk = l.b(MathHelper.b(p), MathHelper.b(r)); + + return (c == 1 || l.k > 0) && W.nextInt(10) == 0 && chunk.a(0x3ad8025fL).nextInt(10) == 0 && q < 16D; + } + + protected float i() { + return 0.6F; + } +} diff --git a/src/main/java/net/minecraft/server/EntitySpider.java b/src/main/java/net/minecraft/server/EntitySpider.java new file mode 100644 index 00000000..b1a060d4 --- /dev/null +++ b/src/main/java/net/minecraft/server/EntitySpider.java @@ -0,0 +1,79 @@ +package net.minecraft.server; + +import java.util.Random; + +public class EntitySpider extends EntityMobs { + + public EntitySpider(World world) { + super(world); + aP = "/mob/spider.png"; + a(1.4F, 0.9F); + bC = 0.8F; + } + + public double k() { + return (double) J * 0.75D - 0.5D; + } + + protected Entity l() { + float f1 = b(1.0F); + + if (f1 < 0.5F) { + double d = 16D; + + return ((Entity) (l.a(((Entity) (this)), d))); + } else { + return null; + } + } + + protected String e() { + return "mob.spider"; + } + + protected String f() { + return "mob.spider"; + } + + protected String g() { + return "mob.spiderdeath"; + } + + protected void a(Entity entity, float f1) { + float f2 = b(1.0F); + + if (f2 > 0.5F && W.nextInt(100) == 0) { + this.d = null; + return; + } + if (f1 > 2.0F && f1 < 6F && W.nextInt(10) == 0) { + if (A) { + double d = entity.p - p; + double d1 = entity.r - r; + float f3 = MathHelper.a(d * d + d1 * d1); + + s = (d / (double) f3) * 0.5D * 0.80000001192092896D + s * 0.20000000298023224D; + u = (d1 / (double) f3) * 0.5D * 0.80000001192092896D + u * 0.20000000298023224D; + t = 0.40000000596046448D; + } + } else { + super.a(entity, f1); + } + } + + public void a(NBTTagCompound nbttagcompound) { + super.a(nbttagcompound); + } + + public void b(NBTTagCompound nbttagcompound) { + super.b(nbttagcompound); + } + + protected int h() { + return Item.I.ba; + } + + public boolean m() { + return B; + } +} diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java new file mode 100644 index 00000000..be757205 --- /dev/null +++ b/src/main/java/net/minecraft/server/EntitySquid.java @@ -0,0 +1,159 @@ +package net.minecraft.server; + +import java.util.Random; + +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 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; + } + + public void a(NBTTagCompound nbttagcompound) { + super.a(nbttagcompound); + } + + public void b(NBTTagCompound nbttagcompound) { + super.b(nbttagcompound); + } + + protected String e() { + return null; + } + + protected String f() { + return null; + } + + protected String g() { + return null; + } + + protected float i() { + return 0.4F; + } + + protected int h() { + return 0; + } + + protected void g_() { + int j = W.nextInt(3) + 1; + + for (int k = 0; k < j; k++) { + a(new ItemStack(Item.aU, 1, 0), 0.0F); + } + } + + public boolean a(EntityPlayer entityplayer) { + ItemStack itemstack = entityplayer.an.e(); + + if (itemstack != null && itemstack.c == Item.au.ba) { + entityplayer.an.a(entityplayer.an.c, new ItemStack(Item.aE)); + return true; + } else { + return false; + } + } + + public boolean v() { + return l.a(z.b(0.0D, -0.60000002384185791D, 0.0D), Material.f, ((Entity) (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; + } + } + 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; + } else { + aq = aq * 0.8F; + } + } else { + am = 0.0F; + ao = ao * 0.9F; + aq = aq * 0.99F; + } + if (!aW) { + s = ar * ao; + t = as * ao; + u = at * 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; + } 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; + } + a += ((float) ((double) (-90F - a) * 0.02D)); + } + } + + public void c(float f1, float f2) { + c(s, t, u); + } + + 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; + + ar = MathHelper.b(f1) * 0.2F; + as = -0.1F + W.nextFloat() * 0.2F; + at = MathHelper.a(f1) * 0.2F; + } + } +} diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java new file mode 100644 index 00000000..0633b96a --- /dev/null +++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java @@ -0,0 +1,71 @@ +package net.minecraft.server; + +public class EntityTNTPrimed extends Entity { + + public int a; + + public EntityTNTPrimed(World world) { + super(world); + a = 0; + i = true; + a(0.98F, 0.98F); + H = J / 2.0F; + } + + public EntityTNTPrimed(World world, double d1, double d2, double d3) { + this(world); + a(d1, d2, d3); + float f = (float) (Math.random() * 3.1415927410125732D * 2D); + + s = -MathHelper.a((f * 3.141593F) / 180F) * 0.02F; + t = 0.20000000298023224D; + u = -MathHelper.b((f * 3.141593F) / 180F) * 0.02F; + M = false; + a = 80; + m = d1; + n = d2; + o = d3; + } + + protected void a() {} + + public boolean c_() { + return !G; + } + + public void b_() { + m = p; + n = q; + o = r; + t -= 0.039999999105930328D; + c(s, t, u); + s *= 0.98000001907348633D; + t *= 0.98000001907348633D; + u *= 0.98000001907348633D; + if (A) { + s *= 0.69999998807907104D; + u *= 0.69999998807907104D; + t *= -0.5D; + } + if (a-- <= 0) { + q(); + d(); + } else { + l.a("smoke", p, q + 0.5D, r, 0.0D, 0.0D, 0.0D); + } + } + + private void d() { + float f = 4F; + + l.a(((Entity) (null)), p, q, r, f); + } + + protected void a(NBTTagCompound nbttagcompound) { + nbttagcompound.a("Fuse", (byte) a); + } + + protected void b(NBTTagCompound nbttagcompound) { + a = ((int) (nbttagcompound.b("Fuse"))); + } +} diff --git a/src/main/java/net/minecraft/server/EntityTracker.java b/src/main/java/net/minecraft/server/EntityTracker.java new file mode 100644 index 00000000..cd6fe4be --- /dev/null +++ b/src/main/java/net/minecraft/server/EntityTracker.java @@ -0,0 +1,155 @@ +package net.minecraft.server; + +import java.util.*; + +public class EntityTracker { + + private Set a; + private MCHashTable b; + private MinecraftServer c; + private int d; + + public EntityTracker(MinecraftServer minecraftserver) { + a = ((Set) (new HashSet())); + b = new MCHashTable(); + c = minecraftserver; + d = minecraftserver.f.a(); + } + + public void a(Entity entity) { + if (entity instanceof EntityPlayerMP) { + a(entity, 512, 2); + EntityPlayerMP entityplayermp = (EntityPlayerMP) entity; + Iterator iterator = a.iterator(); + + do { + if (!iterator.hasNext()) { + break; + } + EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next(); + + if (entitytrackerentry.a != entityplayermp) { + entitytrackerentry.b(entityplayermp); + } + } while (true); + } else if (entity instanceof EntityFish) { + a(entity, 64, 5, true); + } else if (entity instanceof EntityArrow) { + a(entity, 64, 5, true); + } else if (entity instanceof EntitySnowball) { + a(entity, 64, 5, true); + } else if (entity instanceof EntityEgg) { + a(entity, 64, 5, true); + } else if (entity instanceof EntityItem) { + a(entity, 64, 20, true); + } else if (entity instanceof EntityMinecart) { + a(entity, 160, 5, true); + } else if (entity instanceof EntityBoat) { + a(entity, 160, 5, true); + } else if (entity instanceof EntitySquid) { + a(entity, 160, 3, true); + } else if (entity instanceof IAnimals) { + a(entity, 160, 3); + } else if (entity instanceof EntityTNTPrimed) { + a(entity, 160, 10, true); + } else if (entity instanceof EntityFallingSand) { + a(entity, 160, 20, true); + } else if (entity instanceof EntityPainting) { + a(entity, 160, 0x7fffffff, false); + } + } + + public void a(Entity entity, int i, int j) { + a(entity, i, j, false); + } + + public void a(Entity entity, int i, int j, boolean flag) { + if (i > d) { + i = d; + } + if (b.b(entity.g)) { + throw new IllegalStateException("Entity is already tracked!"); + } else { + EntityTrackerEntry entitytrackerentry = new EntityTrackerEntry(entity, i, j, flag); + + a.add(((entitytrackerentry))); + b.a(entity.g, ((entitytrackerentry))); + entitytrackerentry.b(c.e.d); + return; + } + } + + public void b(Entity entity) { + if (entity instanceof EntityPlayerMP) { + EntityPlayerMP entityplayermp = (EntityPlayerMP) entity; + EntityTrackerEntry entitytrackerentry1; + + for (Iterator iterator = a.iterator(); iterator.hasNext(); entitytrackerentry1.a(entityplayermp)) { + entitytrackerentry1 = (EntityTrackerEntry) iterator.next(); + } + } + EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) b.d(entity.g); + + if (entitytrackerentry != null) { + a.remove(((entitytrackerentry))); + entitytrackerentry.a(); + } + } + + public void a() { + ArrayList arraylist = new ArrayList(); + Iterator iterator = a.iterator(); + + do { + if (!iterator.hasNext()) { + break; + } + EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next(); + + entitytrackerentry.a(c.e.d); + if (entitytrackerentry.m && (entitytrackerentry.a instanceof EntityPlayerMP)) { + ((List) (arraylist)).add((((EntityPlayerMP) entitytrackerentry.a))); + } + } while (true); + label0: + for (int i = 0; i < ((List) (arraylist)).size(); i++) { + EntityPlayerMP entityplayermp = (EntityPlayerMP) ((List) (arraylist)).get(i); + Iterator iterator1 = a.iterator(); + + do { + if (!iterator1.hasNext()) { + continue label0; + } + EntityTrackerEntry entitytrackerentry1 = (EntityTrackerEntry) iterator1.next(); + + if (entitytrackerentry1.a != entityplayermp) { + entitytrackerentry1.b(entityplayermp); + } + } while (true); + } + } + + public void a(Entity entity, Packet packet) { + EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) b.a(entity.g); + + if (entitytrackerentry != null) { + entitytrackerentry.a(packet); + } + } + + public void b(Entity entity, Packet packet) { + EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) b.a(entity.g); + + if (entitytrackerentry != null) { + entitytrackerentry.b(packet); + } + } + + public void a(EntityPlayerMP entityplayermp) { + EntityTrackerEntry entitytrackerentry; + + for (Iterator iterator = a.iterator(); iterator.hasNext(); entitytrackerentry.c(entityplayermp)) { + entitytrackerentry = (EntityTrackerEntry) iterator.next(); + } + } +} diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java new file mode 100644 index 00000000..6fdb67e9 --- /dev/null +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java @@ -0,0 +1,252 @@ +package net.minecraft.server; + +import java.util.*; + +public class EntityTrackerEntry { + + public Entity a; + public int b; + public int c; + public int d; + public int e; + public int f; + public int g; + public int h; + public double i; + public double j; + public double k; + public int l; + private double o; + private double p; + private double q; + private boolean r; + private boolean s; + public boolean m; + public Set n; + + public EntityTrackerEntry(Entity entity, int i1, int j1, boolean flag) { + l = 0; + r = false; + m = false; + n = ((Set) (new HashSet())); + a = entity; + b = i1; + c = j1; + s = flag; + d = MathHelper.b(entity.p * 32D); + e = MathHelper.b(entity.q * 32D); + f = MathHelper.b(entity.r * 32D); + g = MathHelper.d((entity.v * 256F) / 360F); + h = MathHelper.d((entity.w * 256F) / 360F); + } + + public boolean equals(Object obj) { + if (obj instanceof EntityTrackerEntry) { + return ((EntityTrackerEntry) obj).a.g == a.g; + } else { + return false; + } + } + + public int hashCode() { + return a.g; + } + + public void a(List list) { + m = false; + if (!r || a.d(o, p, q) > 16D) { + o = a.p; + p = a.q; + q = a.r; + r = true; + m = true; + b(list); + } + if (++l % c == 0) { + int i1 = MathHelper.b(a.p * 32D); + int j1 = MathHelper.b(a.q * 32D); + int k1 = MathHelper.b(a.r * 32D); + int l1 = MathHelper.d((a.v * 256F) / 360F); + int i2 = MathHelper.d((a.w * 256F) / 360F); + boolean flag = i1 != d || j1 != e || k1 != f; + boolean flag1 = l1 != g || i2 != h; + int j2 = i1 - d; + int k2 = j1 - e; + int l2 = k1 - f; + Object obj = null; + + if (j2 < -128 || j2 >= 128 || k2 < -128 || k2 >= 128 || l2 < -128 || l2 >= 128) { + obj = ((new Packet34EntityTeleport(a.g, i1, j1, k1, (byte) l1, (byte) i2))); + } else if (flag && flag1) { + obj = ((new Packet33RelEntityMoveLook(a.g, (byte) j2, (byte) k2, (byte) l2, (byte) l1, (byte) i2))); + } else if (flag) { + obj = ((new Packet31RelEntityMove(a.g, (byte) j2, (byte) k2, (byte) l2))); + } else if (flag1) { + obj = ((new Packet32EntityLook(a.g, (byte) l1, (byte) i2))); + } else { + obj = ((new Packet30Entity(a.g))); + } + if (s) { + double d1 = a.s - i; + double d2 = a.t - j; + double d3 = a.u - k; + double d4 = 0.02D; + double d5 = d1 * d1 + d2 * d2 + d3 * d3; + + if (d5 > d4 * d4 || d5 > 0.0D && a.s == 0.0D && a.t == 0.0D && a.u == 0.0D) { + i = a.s; + j = a.t; + k = a.u; + a(((Packet) (new Packet28(a.g, i, j, k)))); + } + } + if (obj != null) { + a(((Packet) (obj))); + } + DataWatcher datawatcher = a.p(); + + if (datawatcher.a()) { + b(((Packet) (new Packet40(a.g, datawatcher)))); + } + d = i1; + e = j1; + f = k1; + g = l1; + h = i2; + } + if (a.E) { + b(((Packet) (new Packet28(a)))); + a.E = false; + } + } + + public void a(Packet packet) { + EntityPlayerMP entityplayermp; + + for (Iterator iterator = n.iterator(); iterator.hasNext(); entityplayermp.a.b(packet)) { + entityplayermp = (EntityPlayerMP) iterator.next(); + } + } + + public void b(Packet packet) { + a(packet); + if (a instanceof EntityPlayerMP) { + ((EntityPlayerMP) a).a.b(packet); + } + } + + public void a() { + a(((Packet) (new Packet29DestroyEntity(a.g)))); + } + + public void a(EntityPlayerMP entityplayermp) { + if (n.contains(((entityplayermp)))) { + n.remove(((entityplayermp))); + } + } + + public void b(EntityPlayerMP entityplayermp) { + if (entityplayermp == a) { + return; + } + double d1 = entityplayermp.p - (double) (d / 32); + double d2 = entityplayermp.r - (double) (f / 32); + + if (d1 >= (double) (-b) && d1 <= (double) b && d2 >= (double) (-b) && d2 <= (double) b) { + if (!n.contains(((entityplayermp)))) { + n.add(((entityplayermp))); + entityplayermp.a.b(b()); + if (s) { + entityplayermp.a.b(((Packet) (new Packet28(a.g, a.s, a.t, a.u)))); + } + ItemStack aitemstack[] = a.I(); + + if (aitemstack != null) { + for (int i1 = 0; i1 < aitemstack.length; i1++) { + entityplayermp.a.b(((Packet) (new Packet5PlayerInventory(a.g, i1, aitemstack[i1])))); + } + } + } + } else if (n.contains(((entityplayermp)))) { + n.remove(((entityplayermp))); + entityplayermp.a.b(((Packet) (new Packet29DestroyEntity(a.g)))); + } + } + + public void b(List list) { + for (int i1 = 0; i1 < list.size(); i1++) { + b((EntityPlayerMP) list.get(i1)); + } + } + + private Packet b() { + if (a instanceof EntityItem) { + EntityItem entityitem = (EntityItem) a; + Packet21PickupSpawn packet21pickupspawn = new Packet21PickupSpawn(entityitem); + + entityitem.p = (double) packet21pickupspawn.b / 32D; + entityitem.q = (double) packet21pickupspawn.c / 32D; + entityitem.r = (double) packet21pickupspawn.d / 32D; + return ((Packet) (packet21pickupspawn)); + } + if (a instanceof EntityPlayerMP) { + return ((Packet) (new Packet20NamedEntitySpawn((EntityPlayer) a))); + } + if (a instanceof EntityMinecart) { + EntityMinecart entityminecart = (EntityMinecart) a; + + if (entityminecart.d == 0) { + return ((Packet) (new Packet23VehicleSpawn(a, 10))); + } + if (entityminecart.d == 1) { + return ((Packet) (new Packet23VehicleSpawn(a, 11))); + } + if (entityminecart.d == 2) { + return ((Packet) (new Packet23VehicleSpawn(a, 12))); + } + } + if (a instanceof EntityBoat) { + return ((Packet) (new Packet23VehicleSpawn(a, 1))); + } + if (a instanceof IAnimals) { + return ((Packet) (new Packet24MobSpawn((EntityLiving) a))); + } + if (a instanceof EntityFish) { + return ((Packet) (new Packet23VehicleSpawn(a, 90))); + } + if (a instanceof EntityArrow) { + return ((Packet) (new Packet23VehicleSpawn(a, 60))); + } + if (a instanceof EntitySnowball) { + return ((Packet) (new Packet23VehicleSpawn(a, 61))); + } + if (a instanceof EntityEgg) { + return ((Packet) (new Packet23VehicleSpawn(a, 62))); + } + if (a instanceof EntityTNTPrimed) { + return ((Packet) (new Packet23VehicleSpawn(a, 50))); + } + if (a instanceof EntityFallingSand) { + EntityFallingSand entityfallingsand = (EntityFallingSand) a; + + if (entityfallingsand.a == Block.E.bi) { + return ((Packet) (new Packet23VehicleSpawn(a, 70))); + } + if (entityfallingsand.a == Block.F.bi) { + return ((Packet) (new Packet23VehicleSpawn(a, 71))); + } + } + if (a instanceof EntityPainting) { + return ((Packet) (new Packet25((EntityPainting) a))); + } else { + throw new IllegalArgumentException((new StringBuilder()).append("Don't know how to add ").append(((((a)).getClass()))).append("!").toString()); + } + } + + public void c(EntityPlayerMP entityplayermp) { + if (n.contains(((entityplayermp)))) { + n.remove(((entityplayermp))); + entityplayermp.a.b(((Packet) (new Packet29DestroyEntity(a.g)))); + } + } +} diff --git a/src/main/java/net/minecraft/server/EntityWaterMob.java b/src/main/java/net/minecraft/server/EntityWaterMob.java new file mode 100644 index 00000000..64a9113d --- /dev/null +++ b/src/main/java/net/minecraft/server/EntityWaterMob.java @@ -0,0 +1,28 @@ +package net.minecraft.server; + +public class EntityWaterMob extends EntityCreature implements IAnimals { + + public EntityWaterMob(World world) { + super(world); + } + + public boolean d_() { + return true; + } + + public void a(NBTTagCompound nbttagcompound) { + super.a(nbttagcompound); + } + + public void b(NBTTagCompound nbttagcompound) { + super.b(nbttagcompound); + } + + public boolean b() { + return l.a(z); + } + + public int c() { + return 120; + } +} diff --git a/src/main/java/net/minecraft/server/EntityZombieSimple.java b/src/main/java/net/minecraft/server/EntityZombieSimple.java new file mode 100644 index 00000000..b8a7c7b8 --- /dev/null +++ b/src/main/java/net/minecraft/server/EntityZombieSimple.java @@ -0,0 +1,18 @@ +package net.minecraft.server; + +public class EntityZombieSimple extends EntityMobs { + + public EntityZombieSimple(World world) { + super(world); + aP = "/mob/zombie.png"; + bC = 0.5F; + c = 50; + aZ *= 10; + H *= 6F; + a(I * 6F, J * 6F); + } + + protected float a(int i, int j, int k) { + return l.l(i, j, k) - 0.5F; + } +} |