From 6c09066e224ac85b8a6464eaf8f53edfeb4beda4 Mon Sep 17 00:00:00 2001 From: Nate Mortensen Date: Mon, 1 Jul 2013 06:03:00 -0500 Subject: Update CraftBukkit to 1.6.1 --- .../java/net/minecraft/server/EntityWither.java | 189 ++++++++++----------- 1 file changed, 91 insertions(+), 98 deletions(-) (limited to 'src/main/java/net/minecraft/server/EntityWither.java') diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java index 176f8099..bd260822 100644 --- a/src/main/java/net/minecraft/server/EntityWither.java +++ b/src/main/java/net/minecraft/server/EntityWither.java @@ -9,36 +9,33 @@ import org.bukkit.event.entity.ExplosionPrimeEvent; public class EntityWither extends EntityMonster implements IRangedEntity { - private float[] d = new float[2]; - private float[] e = new float[2]; - private float[] f = new float[2]; - private float[] g = new float[2]; - private int[] h = new int[2]; - private int[] i = new int[2]; - private int j; - private static final IEntitySelector bK = new EntitySelectorNotUndead(); + private float[] bp = new float[2]; + private float[] bq = new float[2]; + private float[] br = new float[2]; + private float[] bs = new float[2]; + private int[] bt = new int[2]; + private int[] bu = new int[2]; + private int bv; + private static final IEntitySelector bw = new EntitySelectorNotUndead(); public EntityWither(World world) { super(world); this.setHealth(this.getMaxHealth()); - this.texture = "/mob/wither.png"; this.a(0.9F, 4.0F); this.fireProof = true; - this.bI = 0.6F; this.getNavigation().e(true); this.goalSelector.a(0, new PathfinderGoalFloat(this)); - this.goalSelector.a(2, new PathfinderGoalArrowAttack(this, this.bI, 40, 20.0F)); - this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, this.bI)); + this.goalSelector.a(2, new PathfinderGoalArrowAttack(this, 1.0D, 40, 20.0F)); + this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, 1.0D)); this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F)); this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this)); this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, false)); - this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityLiving.class, 30.0F, 0, false, false, bK)); - this.be = 50; + this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityInsentient.class, 0, false, false, bw)); + this.b = 50; } protected void a() { super.a(); - this.datawatcher.a(16, new Integer(100)); this.datawatcher.a(17, new Integer(0)); this.datawatcher.a(18, new Integer(0)); this.datawatcher.a(19, new Integer(0)); @@ -47,42 +44,37 @@ public class EntityWither extends EntityMonster implements IRangedEntity { public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); - nbttagcompound.setInt("Invul", this.n()); + nbttagcompound.setInt("Invul", this.bQ()); } public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); - this.t(nbttagcompound.getInt("Invul")); - this.datawatcher.watch(16, Integer.valueOf(this.health)); + this.p(nbttagcompound.getInt("Invul")); } - protected String bb() { + protected String r() { return "mob.wither.idle"; } - protected String bc() { + protected String aK() { return "mob.wither.hurt"; } - protected String bd() { + protected String aL() { return "mob.wither.death"; } public void c() { - if (!this.world.isStatic) { - this.datawatcher.watch(16, Integer.valueOf(this.getScaledHealth())); // CraftBukkit - this.health -> this.getScaledHealth() - } - this.motY *= 0.6000000238418579D; double d0; double d1; double d2; - if (!this.world.isStatic && this.u(0) > 0) { - Entity entity = this.world.getEntity(this.u(0)); + if (!this.world.isStatic && this.q(0) > 0) { + Entity entity = this.world.getEntity(this.q(0)); if (entity != null) { - if (this.locY < entity.locY || !this.o() && this.locY < entity.locY + 5.0D) { + if (this.locY < entity.locY || !this.bR() && this.locY < entity.locY + 5.0D) { if (this.motY < 0.0D) { this.motY = 0.0D; } @@ -111,14 +103,14 @@ public class EntityWither extends EntityMonster implements IRangedEntity { int i; for (i = 0; i < 2; ++i) { - this.g[i] = this.e[i]; - this.f[i] = this.d[i]; + this.bs[i] = this.bq[i]; + this.br[i] = this.bp[i]; } int j; for (i = 0; i < 2; ++i) { - j = this.u(i + 1); + j = this.q(i + 1); Entity entity1 = null; if (j > 0) { @@ -126,9 +118,9 @@ public class EntityWither extends EntityMonster implements IRangedEntity { } if (entity1 != null) { - d0 = this.v(i + 1); - d1 = this.w(i + 1); - d2 = this.x(i + 1); + d0 = this.r(i + 1); + d1 = this.s(i + 1); + d2 = this.t(i + 1); double d4 = entity1.locX - d0; double d5 = entity1.locY + (double) entity1.getHeadHeight() - d1; double d6 = entity1.locZ - d2; @@ -136,19 +128,19 @@ public class EntityWither extends EntityMonster implements IRangedEntity { float f = (float) (Math.atan2(d6, d4) * 180.0D / 3.1415927410125732D) - 90.0F; float f1 = (float) (-(Math.atan2(d5, d7) * 180.0D / 3.1415927410125732D)); - this.d[i] = this.b(this.d[i], f1, 40.0F); - this.e[i] = this.b(this.e[i], f, 10.0F); + this.bp[i] = this.b(this.bp[i], f1, 40.0F); + this.bq[i] = this.b(this.bq[i], f, 10.0F); } else { - this.e[i] = this.b(this.e[i], this.ay, 10.0F); + this.bq[i] = this.b(this.bq[i], this.aN, 10.0F); } } - boolean flag = this.o(); + boolean flag = this.bR(); for (j = 0; j < 3; ++j) { - double d8 = this.v(j); - double d9 = this.w(j); - double d10 = this.x(j); + double d8 = this.r(j); + double d9 = this.s(j); + double d10 = this.t(j); this.world.addParticle("smoke", d8 + this.random.nextGaussian() * 0.30000001192092896D, d9 + this.random.nextGaussian() * 0.30000001192092896D, d10 + this.random.nextGaussian() * 0.30000001192092896D, 0.0D, 0.0D, 0.0D); if (flag && this.world.random.nextInt(4) == 0) { @@ -156,18 +148,18 @@ public class EntityWither extends EntityMonster implements IRangedEntity { } } - if (this.n() > 0) { + if (this.bQ() > 0) { for (j = 0; j < 3; ++j) { this.world.addParticle("mobSpell", this.locX + this.random.nextGaussian() * 1.0D, this.locY + (double) (this.random.nextFloat() * 3.3F), this.locZ + this.random.nextGaussian() * 1.0D, 0.699999988079071D, 0.699999988079071D, 0.8999999761581421D); } } } - protected void bo() { + protected void be() { int i; - if (this.n() > 0) { - i = this.n() - 1; + if (this.bQ() > 0) { + i = this.bQ() - 1; if (i <= 0) { // CraftBukkit start ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 7.0F, false); @@ -178,26 +170,27 @@ public class EntityWither extends EntityMonster implements IRangedEntity { } // CraftBukkit end + this.world.createExplosion(this, this.locX, this.locY + (double) this.getHeadHeight(), this.locZ, 7.0F, false, this.world.getGameRules().getBoolean("mobGriefing")); this.world.d(1013, (int) this.locX, (int) this.locY, (int) this.locZ, 0); } - this.t(i); + this.p(i); if (this.ticksLived % 10 == 0) { - this.heal(10, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.WITHER_SPAWN); // CraftBukkit + this.heal(10.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.WITHER_SPAWN); // CraftBukkit } } else { - super.bo(); + super.be(); int j; for (i = 1; i < 3; ++i) { - if (this.ticksLived >= this.h[i - 1]) { - this.h[i - 1] = this.ticksLived + 10 + this.random.nextInt(10); + if (this.ticksLived >= this.bt[i - 1]) { + this.bt[i - 1] = this.ticksLived + 10 + this.random.nextInt(10); if (this.world.difficulty >= 2) { int i1001 = i - 1; - int i1003 = this.i[i - 1]; + int i1003 = this.bu[i - 1]; - this.i[i1001] = this.i[i - 1] + 1; + this.bu[i1001] = this.bu[i - 1] + 1; if (i1003 > 15) { float f = 10.0F; float f1 = 5.0F; @@ -206,28 +199,28 @@ public class EntityWither extends EntityMonster implements IRangedEntity { double d2 = MathHelper.a(this.random, this.locZ - (double) f, this.locZ + (double) f); this.a(i + 1, d0, d1, d2, true); - this.i[i - 1] = 0; + this.bu[i - 1] = 0; } } - j = this.u(i); + j = this.q(i); if (j > 0) { Entity entity = this.world.getEntity(j); - if (entity != null && entity.isAlive() && this.e(entity) <= 900.0D && this.n(entity)) { + if (entity != null && entity.isAlive() && this.e(entity) <= 900.0D && this.o(entity)) { this.a(i + 1, (EntityLiving) entity); - this.h[i - 1] = this.ticksLived + 40 + this.random.nextInt(20); - this.i[i - 1] = 0; + this.bt[i - 1] = this.ticksLived + 40 + this.random.nextInt(20); + this.bu[i - 1] = 0; } else { this.c(i, 0); } } else { - List list = this.world.a(EntityLiving.class, this.boundingBox.grow(20.0D, 8.0D, 20.0D), bK); + List list = this.world.a(EntityLiving.class, this.boundingBox.grow(20.0D, 8.0D, 20.0D), bw); for (int i1 = 0; i1 < 10 && !list.isEmpty(); ++i1) { EntityLiving entityliving = (EntityLiving) list.get(this.random.nextInt(list.size())); - if (entityliving != this && entityliving.isAlive() && this.n(entityliving)) { + if (entityliving != this && entityliving.isAlive() && this.o(entityliving)) { if (entityliving instanceof EntityHuman) { if (!((EntityHuman) entityliving).abilities.isInvulnerable) { this.c(i, entityliving.id); @@ -250,9 +243,9 @@ public class EntityWither extends EntityMonster implements IRangedEntity { this.c(0, 0); } - if (this.j > 0) { - --this.j; - if (this.j == 0 && this.world.getGameRules().getBoolean("mobGriefing")) { + if (this.bv > 0) { + --this.bv; + if (this.bv == 0 && this.world.getGameRules().getBoolean("mobGriefing")) { i = MathHelper.floor(this.locY); j = MathHelper.floor(this.locX); int j1 = MathHelper.floor(this.locZ); @@ -286,42 +279,42 @@ public class EntityWither extends EntityMonster implements IRangedEntity { } if (this.ticksLived % 20 == 0) { - this.heal(1); + this.heal(1.0F); } } } - public void m() { - this.t(220); - this.setHealth(this.getMaxHealth() / 3); + public void bP() { + this.p(220); + this.setHealth(this.getMaxHealth() / 3.0F); } - public void al() {} + public void ak() {} - public int aZ() { + public int aM() { return 4; } - private double v(int i) { + private double r(int i) { if (i <= 0) { return this.locX; } else { - float f = (this.ay + (float) (180 * (i - 1))) / 180.0F * 3.1415927F; + float f = (this.aN + (float) (180 * (i - 1))) / 180.0F * 3.1415927F; float f1 = MathHelper.cos(f); return this.locX + (double) f1 * 1.3D; } } - private double w(int i) { + private double s(int i) { return i <= 0 ? this.locY + 3.0D : this.locY + 2.2D; } - private double x(int i) { + private double t(int i) { if (i <= 0) { return this.locZ; } else { - float f = (this.ay + (float) (180 * (i - 1))) / 180.0F * 3.1415927F; + float f = (this.aN + (float) (180 * (i - 1))) / 180.0F * 3.1415927F; float f1 = MathHelper.sin(f); return this.locZ + (double) f1 * 1.3D; @@ -348,9 +341,9 @@ public class EntityWither extends EntityMonster implements IRangedEntity { private void a(int i, double d0, double d1, double d2, boolean flag) { this.world.a((EntityHuman) null, 1014, (int) this.locX, (int) this.locY, (int) this.locZ, 0); - double d3 = this.v(i); - double d4 = this.w(i); - double d5 = this.x(i); + double d3 = this.r(i); + double d4 = this.s(i); + double d5 = this.t(i); double d6 = d0 - d3; double d7 = d1 - d4; double d8 = d2 - d5; @@ -370,17 +363,17 @@ public class EntityWither extends EntityMonster implements IRangedEntity { this.a(0, entityliving); } - public boolean damageEntity(DamageSource damagesource, int i) { + public boolean damageEntity(DamageSource damagesource, float f) { if (this.isInvulnerable()) { return false; } else if (damagesource == DamageSource.DROWN) { return false; - } else if (this.n() > 0) { + } else if (this.bQ() > 0) { return false; } else { Entity entity; - if (this.o()) { + if (this.bR()) { entity = damagesource.h(); if (entity instanceof EntityArrow) { return false; @@ -391,15 +384,15 @@ public class EntityWither extends EntityMonster implements IRangedEntity { if (entity != null && !(entity instanceof EntityHuman) && entity instanceof EntityLiving && ((EntityLiving) entity).getMonsterType() == this.getMonsterType()) { return false; } else { - if (this.j <= 0) { - this.j = 20; + if (this.bv <= 0) { + this.bv = 20; } - for (int j = 0; j < this.i.length; ++j) { - this.i[j] += 3; + for (int i = 0; i < this.bu.length; ++i) { + this.bu[i] += 3; } - return super.damageEntity(damagesource, i); + return super.damageEntity(damagesource, f); } } } @@ -412,39 +405,39 @@ public class EntityWither extends EntityMonster implements IRangedEntity { // CraftBukkit end } - protected void bn() { - this.bC = 0; + protected void bk() { + this.aV = 0; } public boolean K() { return !this.dead; } - public int b() { - return this.datawatcher.getInt(16); + protected void b(float f) { } - protected void a(float f) {} - public void addEffect(MobEffect mobeffect) {} - protected boolean bh() { + protected boolean bb() { return true; } - public int getMaxHealth() { - return 300; + protected void ax() { + super.ax(); + this.a(GenericAttributes.a).a(300.0D); + this.a(GenericAttributes.d).a(0.6000000238418579D); + this.a(GenericAttributes.b).a(40.0D); } - public int n() { + public int bQ() { return this.datawatcher.getInt(20); } - public void t(int i) { + public void p(int i) { this.datawatcher.watch(20, Integer.valueOf(i)); } - public int u(int i) { + public int q(int i) { return this.datawatcher.getInt(17 + i); } @@ -452,8 +445,8 @@ public class EntityWither extends EntityMonster implements IRangedEntity { this.datawatcher.watch(17 + i, Integer.valueOf(j)); } - public boolean o() { - return this.b() <= this.maxHealth / 2; // CraftBukkit - this.getMaxHealth() -> this.maxHealth + public boolean bR() { + return this.getHealth() <= this.maxHealth / 2.0F; // CraftBukkit - this.getMaxHealth() -> this.maxHealth } public EnumMonsterType getMonsterType() { -- cgit v1.2.3