diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2012-11-06 06:05:28 -0600 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2012-11-13 16:09:52 -0600 |
commit | 7f7192f8fd8357e664e7e2d6e7c5f65fd0fcd2f7 (patch) | |
tree | 843902ff94d82e86f40d7e0af1ac838fee859e75 /src/main/java/net/minecraft/server/EntityEnderDragon.java | |
parent | a0c3b4f9d1b403fa64230f22b5dd3222181ba646 (diff) | |
download | craftbukkit-7f7192f8fd8357e664e7e2d6e7c5f65fd0fcd2f7.tar craftbukkit-7f7192f8fd8357e664e7e2d6e7c5f65fd0fcd2f7.tar.gz craftbukkit-7f7192f8fd8357e664e7e2d6e7c5f65fd0fcd2f7.tar.lz craftbukkit-7f7192f8fd8357e664e7e2d6e7c5f65fd0fcd2f7.tar.xz craftbukkit-7f7192f8fd8357e664e7e2d6e7c5f65fd0fcd2f7.zip |
Update CraftBukkit to Minecraft 1.4.4.
Diffstat (limited to 'src/main/java/net/minecraft/server/EntityEnderDragon.java')
-rw-r--r-- | src/main/java/net/minecraft/server/EntityEnderDragon.java | 138 |
1 files changed, 68 insertions, 70 deletions
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java index 75547e9c..066ee78c 100644 --- a/src/main/java/net/minecraft/server/EntityEnderDragon.java +++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java @@ -25,20 +25,20 @@ public class EntityEnderDragon extends EntityLiving implements IComplex { public EntityComplexPart h; public EntityComplexPart i; public EntityComplexPart j; + public EntityComplexPart bI; + public EntityComplexPart bJ; public EntityComplexPart bK; - public EntityComplexPart bL; - public EntityComplexPart bM; - public float bN = 0.0F; - public float bO = 0.0F; - public boolean bP = false; - public boolean bQ = false; - private Entity bT; - public int bR = 0; - public EntityEnderCrystal bS = null; + public float bL = 0.0F; + public float bM = 0.0F; + public boolean bN = false; + public boolean bO = false; + private Entity bR; + public int bP = 0; + public EntityEnderCrystal bQ = null; public EntityEnderDragon(World world) { super(world); - this.children = new EntityComplexPart[] { this.g = new EntityComplexPart(this, "head", 6.0F, 6.0F), this.h = new EntityComplexPart(this, "body", 8.0F, 8.0F), this.i = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.j = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bK = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bL = new EntityComplexPart(this, "wing", 4.0F, 4.0F), this.bM = new EntityComplexPart(this, "wing", 4.0F, 4.0F)}; + this.children = new EntityComplexPart[] { this.g = new EntityComplexPart(this, "head", 6.0F, 6.0F), this.h = new EntityComplexPart(this, "body", 8.0F, 8.0F), this.i = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.j = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bI = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bJ = new EntityComplexPart(this, "wing", 4.0F, 4.0F), this.bK = new EntityComplexPart(this, "wing", 4.0F, 4.0F)}; this.setHealth(this.getMaxHealth()); this.texture = "/mob/enderdragon/ender.png"; this.a(16.0F, 8.0F); @@ -84,14 +84,14 @@ public class EntityEnderDragon extends EntityLiving implements IComplex { if (!this.world.isStatic) { this.datawatcher.watch(16, Integer.valueOf(this.health)); } else { - f = MathHelper.cos(this.bO * 3.1415927F * 2.0F); - f1 = MathHelper.cos(this.bN * 3.1415927F * 2.0F); + f = MathHelper.cos(this.bM * 3.1415927F * 2.0F); + f1 = MathHelper.cos(this.bL * 3.1415927F * 2.0F); if (f1 <= -0.3F && f >= -0.3F) { this.world.b(this.locX, this.locY, this.locZ, "mob.enderdragon.wings", 5.0F, 0.8F + this.random.nextFloat() * 0.3F); } } - this.bN = this.bO; + this.bL = this.bM; float f2; if (this.health <= 0) { @@ -103,10 +103,10 @@ public class EntityEnderDragon extends EntityLiving implements IComplex { this.h(); f = 0.2F / (MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 10.0F + 1.0F); f *= (float) Math.pow(2.0D, this.motY); - if (this.bQ) { - this.bO += f * 0.5F; + if (this.bO) { + this.bM += f * 0.5F; } else { - this.bO += f; + this.bM += f; } this.yaw = MathHelper.g(this.yaw); @@ -130,14 +130,14 @@ public class EntityEnderDragon extends EntityLiving implements IComplex { float f3; if (this.world.isStatic) { - if (this.bu > 0) { - d0 = this.locX + (this.bv - this.locX) / (double) this.bu; - d1 = this.locY + (this.bw - this.locY) / (double) this.bu; - d2 = this.locZ + (this.bx - this.locZ) / (double) this.bu; - d3 = MathHelper.g(this.by - (double) this.yaw); - this.yaw = (float) ((double) this.yaw + d3 / (double) this.bu); - this.pitch = (float) ((double) this.pitch + (this.bz - (double) this.pitch) / (double) this.bu); - --this.bu; + if (this.bs > 0) { + d0 = this.locX + (this.bt - this.locX) / (double) this.bs; + d1 = this.locY + (this.bu - this.locY) / (double) this.bs; + d2 = this.locZ + (this.bv - this.locZ) / (double) this.bs; + d3 = MathHelper.g(this.bw - (double) this.yaw); + this.yaw = (float) ((double) this.yaw + d3 / (double) this.bs); + this.pitch = (float) ((double) this.pitch + (this.bx - (double) this.pitch) / (double) this.bs); + --this.bs; this.setPosition(d0, d1, d2); this.b(this.yaw, this.pitch); } @@ -146,9 +146,9 @@ public class EntityEnderDragon extends EntityLiving implements IComplex { d1 = this.b - this.locY; d2 = this.c - this.locZ; d3 = d0 * d0 + d1 * d1 + d2 * d2; - if (this.bT != null) { - this.a = this.bT.locX; - this.c = this.bT.locZ; + if (this.bR != null) { + this.a = this.bR.locX; + this.c = this.bR.locZ; double d4 = this.a - this.locX; double d5 = this.c - this.locZ; double d6 = Math.sqrt(d4 * d4 + d5 * d5); @@ -158,13 +158,13 @@ public class EntityEnderDragon extends EntityLiving implements IComplex { d7 = 10.0D; } - this.b = this.bT.boundingBox.b + d7; + this.b = this.bR.boundingBox.b + d7; } else { this.a += this.random.nextGaussian() * 2.0D; this.c += this.random.nextGaussian() * 2.0D; } - if (this.bP || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.G) { + if (this.bN || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.G) { this.i(); } @@ -199,7 +199,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex { f4 = 0.0F; } - this.bF *= 0.8F; + this.bD *= 0.8F; float f5 = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 1.0F + 1.0F; double d10 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 1.0D + 1.0D; @@ -207,13 +207,13 @@ public class EntityEnderDragon extends EntityLiving implements IComplex { d10 = 40.0D; } - this.bF = (float) ((double) this.bF + d9 * (0.699999988079071D / d10 / (double) f5)); - this.yaw += this.bF * 0.1F; + this.bD = (float) ((double) this.bD + d9 * (0.699999988079071D / d10 / (double) f5)); + this.yaw += this.bD * 0.1F; float f6 = (float) (2.0D / (d10 + 1.0D)); float f7 = 0.06F; this.a(0.0F, -1.0F, f7 * (f4 * f6 + (1.0F - f6))); - if (this.bQ) { + if (this.bO) { this.move(this.motX * 0.800000011920929D, this.motY * 0.800000011920929D, this.motZ * 0.800000011920929D); } else { this.move(this.motX, this.motY, this.motZ); @@ -232,13 +232,13 @@ public class EntityEnderDragon extends EntityLiving implements IComplex { this.g.width = this.g.length = 3.0F; this.i.width = this.i.length = 2.0F; this.j.width = this.j.length = 2.0F; - this.bK.width = this.bK.length = 2.0F; + this.bI.width = this.bI.length = 2.0F; this.h.length = 3.0F; this.h.width = 5.0F; - this.bL.length = 2.0F; - this.bL.width = 4.0F; - this.bM.length = 3.0F; - this.bM.width = 4.0F; + this.bJ.length = 2.0F; + this.bJ.width = 4.0F; + this.bK.length = 3.0F; + this.bK.width = 4.0F; f1 = (float) (this.a(5, 1.0F)[1] - this.a(10, 1.0F)[1]) * 10.0F / 180.0F * 3.1415927F; f2 = MathHelper.cos(f1); float f9 = -MathHelper.sin(f1); @@ -248,21 +248,21 @@ public class EntityEnderDragon extends EntityLiving implements IComplex { this.h.j_(); this.h.setPositionRotation(this.locX + (double) (f11 * 0.5F), this.locY, this.locZ - (double) (f12 * 0.5F), 0.0F, 0.0F); - this.bL.j_(); - this.bL.setPositionRotation(this.locX + (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ + (double) (f11 * 4.5F), 0.0F, 0.0F); - this.bM.j_(); - this.bM.setPositionRotation(this.locX - (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ - (double) (f11 * 4.5F), 0.0F, 0.0F); + this.bJ.j_(); + this.bJ.setPositionRotation(this.locX + (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ + (double) (f11 * 4.5F), 0.0F, 0.0F); + this.bK.j_(); + this.bK.setPositionRotation(this.locX - (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ - (double) (f11 * 4.5F), 0.0F, 0.0F); if (!this.world.isStatic && this.hurtTicks == 0) { - this.a(this.world.getEntities(this, this.bL.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D))); - this.a(this.world.getEntities(this, this.bM.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D))); + this.a(this.world.getEntities(this, this.bJ.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D))); + this.a(this.world.getEntities(this, this.bK.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D))); this.b(this.world.getEntities(this, this.g.boundingBox.grow(1.0D, 1.0D, 1.0D))); } double[] adouble = this.a(5, 1.0F); double[] adouble1 = this.a(0, 1.0F); - f3 = MathHelper.sin(this.yaw * 3.1415927F / 180.0F - this.bF * 0.01F); - float f13 = MathHelper.cos(this.yaw * 3.1415927F / 180.0F - this.bF * 0.01F); + f3 = MathHelper.sin(this.yaw * 3.1415927F / 180.0F - this.bD * 0.01F); + float f13 = MathHelper.cos(this.yaw * 3.1415927F / 180.0F - this.bD * 0.01F); this.g.j_(); this.g.setPositionRotation(this.locX + (double) (f3 * 5.5F * f2), this.locY + (adouble1[1] - adouble[1]) * 1.0D + (double) (f9 * 5.5F), this.locZ - (double) (f13 * 5.5F * f2), 0.0F, 0.0F); @@ -279,7 +279,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex { } if (j == 2) { - entitycomplexpart = this.bK; + entitycomplexpart = this.bI; } double[] adouble2 = this.a(12 + j * 2, 1.0F); @@ -294,19 +294,19 @@ public class EntityEnderDragon extends EntityLiving implements IComplex { } if (!this.world.isStatic) { - this.bQ = this.a(this.g.boundingBox) | this.a(this.h.boundingBox); + this.bO = this.a(this.g.boundingBox) | this.a(this.h.boundingBox); } } } private void h() { - if (this.bS != null) { - if (this.bS.dead) { + if (this.bQ != null) { + if (this.bQ.dead) { if (!this.world.isStatic) { this.a(this.g, DamageSource.EXPLOSION, 10); } - this.bS = null; + this.bQ = null; } else if (this.ticksLived % 10 == 0 && this.health < this.getMaxHealth()) { // CraftBukkit start EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), 1, EntityRegainHealthEvent.RegainReason.ENDER_CRYSTAL); @@ -336,7 +336,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex { } } - this.bS = entityendercrystal; + this.bQ = entityendercrystal; } } @@ -359,10 +359,8 @@ public class EntityEnderDragon extends EntityLiving implements IComplex { } private void b(List list) { - Iterator iterator = list.iterator(); - - while (iterator.hasNext()) { - Entity entity = (Entity) iterator.next(); + for (int i = 0; i < list.size(); ++i) { + Entity entity = (Entity) list.get(i); if (entity instanceof EntityLiving) { // CraftBukkit start - throw damage events when the dragon attacks @@ -384,9 +382,9 @@ public class EntityEnderDragon extends EntityLiving implements IComplex { } private void i() { - this.bP = false; + this.bN = false; if (this.random.nextInt(2) == 0 && !this.world.players.isEmpty()) { - this.bT = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size())); + this.bR = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size())); } else { boolean flag = false; @@ -403,7 +401,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex { flag = d0 * d0 + d1 * d1 + d2 * d2 > 100.0D; } while (!flag); - this.bT = null; + this.bR = null; } } @@ -484,7 +482,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex { this.a = this.locX + (double) (f1 * 5.0F) + (double) ((this.random.nextFloat() - 0.5F) * 2.0F); this.b = this.locY + (double) (this.random.nextFloat() * 3.0F) + 1.0D; this.c = this.locZ - (double) (f2 * 5.0F) + (double) ((this.random.nextFloat() - 0.5F) * 2.0F); - this.bT = null; + this.bR = null; if (damagesource.getEntity() instanceof EntityHuman || damagesource == DamageSource.EXPLOSION) { this.dealDamage(damagesource, i); } @@ -500,9 +498,9 @@ public class EntityEnderDragon extends EntityLiving implements IComplex { return super.damageEntity(damagesource, i); } - protected void aO() { - ++this.bR; - if (this.bR >= 180 && this.bR <= 200) { + protected void aP() { + ++this.bP; + if (this.bP >= 180 && this.bP <= 200) { float f = (this.random.nextFloat() - 0.5F) * 8.0F; float f1 = (this.random.nextFloat() - 0.5F) * 4.0F; float f2 = (this.random.nextFloat() - 0.5F) * 8.0F; @@ -514,7 +512,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex { int j; if (!this.world.isStatic) { - if (this.bR > 150 && this.bR % 5 == 0) { + if (this.bP > 150 && this.bP % 5 == 0) { i = expToDrop / 12; // CraftBukkit - drop experience as dragon falls from sky. use experience drop from death event. This is now set in getExpReward() while (i > 0) { @@ -524,14 +522,14 @@ public class EntityEnderDragon extends EntityLiving implements IComplex { } } - if (this.bR == 1) { + if (this.bP == 1) { this.world.e(1018, (int) this.locX, (int) this.locY, (int) this.locZ, 0); } } this.move(0.0D, 0.10000000149011612D, 0.0D); this.aw = this.yaw += 20.0F; - if (this.bR == 200 && !this.world.isStatic) { + if (this.bP == 200 && !this.world.isStatic) { i = expToDrop - 10 * (expToDrop / 12); // CraftBukkit - drop the remaining experience while (i > 0) { @@ -611,7 +609,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex { BlockEnderPortal.a = false; } - protected void bh() {} + protected void bk() {} public Entity[] ao() { return this.children; @@ -625,15 +623,15 @@ public class EntityEnderDragon extends EntityLiving implements IComplex { return this.world; } - protected String aW() { + protected String aY() { return "mob.enderdragon.growl"; } - protected String aX() { + protected String aZ() { return "mob.enderdragon.hit"; } - protected float aV() { + protected float aX() { return 5.0F; } |