diff options
Diffstat (limited to 'src/main/java/net/minecraft/server/EntityLiving.java')
-rw-r--r-- | src/main/java/net/minecraft/server/EntityLiving.java | 472 |
1 files changed, 251 insertions, 221 deletions
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java index d6a4c169..362e3b39 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -66,7 +66,6 @@ public abstract class EntityLiving extends Entity { private int f = 0; private EntityLiving g = null; public int bk = 0; - public int bl = 0; public HashMap effects = new HashMap(); // CraftBukkit - protected -> public public boolean updateEffects = true; // CraftBukkit - private -> public private int i; @@ -77,37 +76,36 @@ public abstract class EntityLiving extends Entity { private Navigation navigation; protected final PathfinderGoalSelector goalSelector; protected final PathfinderGoalSelector targetSelector; - private EntityLiving bO; - private EntitySenses bP; - private float bQ; - private ChunkCoordinates bR = new ChunkCoordinates(0, 0, 0); - private float bS = -1.0F; + private EntityLiving bM; + private EntitySenses bN; + private float bO; + private ChunkCoordinates bP = new ChunkCoordinates(0, 0, 0); + private float bQ = -1.0F; private ItemStack[] equipment = new ItemStack[5]; protected float[] dropChances = new float[5]; - private ItemStack[] bU = new ItemStack[5]; - public boolean bq = false; - public int br = 0; + private ItemStack[] bS = new ItemStack[5]; + public boolean bp = false; + public int bq = 0; protected boolean canPickUpLoot = false; private boolean persistent = false; - protected boolean invulnerable = false; - protected int bu; + protected int bs; + protected double bt; + protected double bu; protected double bv; protected double bw; protected double bx; - protected double by; - protected double bz; - float bA = 0.0F; + float by = 0.0F; public int lastDamage = 0; // CraftBukkit - protected -> public - protected int bC = 0; + protected int bA = 0; + protected float bB; + protected float bC; protected float bD; - protected float bE; - protected float bF; - protected boolean bG = false; - protected float bH = 0.0F; - protected float bI = 0.7F; - private int bW = 0; - private Entity bX; - protected int bJ = 0; + protected boolean bE = false; + protected float bF = 0.0F; + protected float bG = 0.7F; + private int bU = 0; + private Entity bV; + protected int bH = 0; public int expToDrop = 0; // CraftBukkit public int maxAirTicks = 300; // CraftBukkit @@ -121,7 +119,7 @@ public abstract class EntityLiving extends Entity { this.jumpController = new ControllerJump(this); this.senses = new EntityAIBodyControl(this); this.navigation = new Navigation(this, world, 16.0F); - this.bP = new EntitySenses(this); + this.bN = new EntitySenses(this); this.av = (float) (Math.random() + 1.0D) * 0.01F; this.setPosition(this.locX, this.locY, this.locZ); this.au = (float) Math.random() * 12398.0F; @@ -151,73 +149,81 @@ public abstract class EntityLiving extends Entity { return this.navigation; } - public EntitySenses az() { - return this.bP; + public EntitySenses aA() { + return this.bN; } - public Random aA() { + public Random aB() { return this.random; } - public EntityLiving aB() { + public EntityLiving aC() { return this.lastDamager; } - public EntityLiving aC() { + public EntityLiving aD() { return this.g; } - public void k(Entity entity) { + public void l(Entity entity) { if (entity instanceof EntityLiving) { this.g = (EntityLiving) entity; } } - public int aD() { - return this.bC; + public int aE() { + return this.bA; } public float ap() { return this.ay; } - public float aE() { - return this.bQ; + public float aF() { + return this.bO; } public void e(float f) { - this.bQ = f; + this.bO = f; this.f(f); } - public boolean l(Entity entity) { - this.k(entity); + public boolean m(Entity entity) { + this.l(entity); return false; } - public EntityLiving aF() { - return this.bO; + public EntityLiving aG() { + return this.bM; } public void b(EntityLiving entityliving) { - this.bO = entityliving; + this.bM = entityliving; } public boolean a(Class oclass) { return EntityCreeper.class != oclass && EntityGhast.class != oclass; } - public void aG() {} + public void aH() {} protected void a(double d0, boolean flag) { + if (!this.H()) { + this.I(); + } + if (flag && this.fallDistance > 0.0F) { int i = MathHelper.floor(this.locX); int j = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height); int k = MathHelper.floor(this.locZ); int l = this.world.getTypeId(i, j, k); - if (l == 0 && this.world.getTypeId(i, j - 1, k) == Block.FENCE.id) { - l = this.world.getTypeId(i, j - 1, k); + if (l == 0) { + int i1 = this.world.e(i, j - 1, k); + + if (i1 == 11 || i1 == 32 || i1 == 21) { + l = this.world.getTypeId(i, j - 1, k); + } } if (l > 0) { @@ -228,33 +234,33 @@ public abstract class EntityLiving extends Entity { super.a(d0, flag); } - public boolean aH() { + public boolean aI() { return this.e(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)); } public boolean e(int i, int j, int k) { - return this.bS == -1.0F ? true : this.bR.e(i, j, k) < this.bS * this.bS; + return this.bQ == -1.0F ? true : this.bP.e(i, j, k) < this.bQ * this.bQ; } public void b(int i, int j, int k, int l) { - this.bR.b(i, j, k); - this.bS = (float) l; + this.bP.b(i, j, k); + this.bQ = (float) l; } - public ChunkCoordinates aI() { - return this.bR; + public ChunkCoordinates aJ() { + return this.bP; } - public float aJ() { - return this.bS; + public float aK() { + return this.bQ; } - public void aK() { - this.bS = -1.0F; + public void aL() { + this.bQ = -1.0F; } - public boolean aL() { - return this.bS != -1.0F; + public boolean aM() { + return this.bQ != -1.0F; } public void c(EntityLiving entityliving) { @@ -265,9 +271,10 @@ public abstract class EntityLiving extends Entity { protected void a() { this.datawatcher.a(8, Integer.valueOf(this.i)); this.datawatcher.a(9, Byte.valueOf((byte) 0)); + this.datawatcher.a(10, Byte.valueOf((byte) 0)); } - public boolean m(Entity entity) { + public boolean n(Entity entity) { return this.world.a(this.world.getVec3DPool().create(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ), this.world.getVec3DPool().create(entity.locX, entity.locY + (double) entity.getHeadHeight(), entity.locZ)) == null; } @@ -283,15 +290,15 @@ public abstract class EntityLiving extends Entity { return this.length * 0.85F; } - public int aM() { + public int aN() { return 80; } - public void aN() { - String s = this.aW(); + public void aO() { + String s = this.aY(); if (s != null) { - this.world.makeSound(this, s, this.aV(), this.h()); + this.makeSound(s, this.aX(), this.aV()); } } @@ -300,8 +307,8 @@ public abstract class EntityLiving extends Entity { super.y(); this.world.methodProfiler.a("mobBaseTick"); if (this.isAlive() && this.random.nextInt(1000) < this.aT++) { - this.aT = -this.aM(); - this.aN(); + this.aT = -this.aN(); + this.aO(); } // CraftBukkit start @@ -320,7 +327,7 @@ public abstract class EntityLiving extends Entity { this.extinguish(); } - if (this.isAlive() && this.a(Material.WATER) && !this.ba() && !this.effects.containsKey(Integer.valueOf(MobEffectList.WATER_BREATHING.id))) { + if (this.isAlive() && this.a(Material.WATER) && !this.bc() && !this.effects.containsKey(Integer.valueOf(MobEffectList.WATER_BREATHING.id))) { this.setAirTicks(this.g(this.getAirTicks())); if (this.getAirTicks() == -20) { this.setAirTicks(0); @@ -367,7 +374,7 @@ public abstract class EntityLiving extends Entity { } if (this.health <= 0) { - this.aO(); + this.aP(); } if (this.lastDamageByPlayerTime > 0) { @@ -390,7 +397,7 @@ public abstract class EntityLiving extends Entity { } } - this.bu(); + this.bx(); this.aD = this.aC; this.ax = this.aw; this.az = this.ay; @@ -411,19 +418,20 @@ public abstract class EntityLiving extends Entity { } // CraftBukkit end - protected void aO() { + protected void aP() { ++this.deathTicks; if (this.deathTicks >= 20 && !this.dead) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead) int i; // CraftBukkit start - update getExpReward() above if the removed if() changes! - i = expToDrop; + i = this.expToDrop; while (i > 0) { int j = EntityExperienceOrb.getOrbValue(i); i -= j; this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY, this.locZ, j)); } + this.expToDrop = 0; // CraftBukkit end this.die(); @@ -452,7 +460,7 @@ public abstract class EntityLiving extends Entity { return false; } - public void aQ() { + public void aR() { for (int i = 0; i < 20; ++i) { double d0 = this.random.nextGaussian() * 0.02D; double d1 = this.random.nextGaussian() * 0.02D; @@ -473,24 +481,27 @@ public abstract class EntityLiving extends Entity { public void j_() { super.j_(); if (!this.world.isStatic) { - for (int i = 0; i < 5; ++i) { + int i; + + for (i = 0; i < 5; ++i) { ItemStack itemstack = this.getEquipment(i); - if (!ItemStack.matches(itemstack, this.bU[i])) { - ((WorldServer) this.world).getTracker().a(this, new Packet5EntityEquipment(this.id, i, itemstack)); - this.bU[i] = itemstack == null ? null : itemstack.cloneItemStack(); + if (!ItemStack.matches(itemstack, this.bS[i])) { + ((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new Packet5EntityEquipment(this.id, i, itemstack))); + this.bS[i] = itemstack == null ? null : itemstack.cloneItemStack(); } } - } - if (this.bk > 0) { - if (this.bl <= 0) { - this.bl = 60; - } + i = this.bJ(); + if (i > 0) { + if (this.bk <= 0) { + this.bk = 20 * (30 - i); + } - --this.bl; - if (this.bl <= 0) { --this.bk; + if (this.bk <= 0) { + this.r(i - 1); + } } } @@ -521,7 +532,7 @@ public abstract class EntityLiving extends Entity { this.aB += (f3 - this.aB) * 0.3F; this.world.methodProfiler.a("headTurn"); - if (this.bb()) { + if (this.be()) { this.senses.a(); } else { float f4 = MathHelper.g(f1 - this.aw); @@ -624,10 +635,12 @@ public abstract class EntityLiving extends Entity { } public boolean damageEntity(DamageSource damagesource, int i) { - if (this.world.isStatic) { + if (this.isInvulnerable()) { + return false; + } else if (this.world.isStatic) { return false; } else { - this.bC = 0; + this.bA = 0; if (this.health <= 0) { return false; } else if (damagesource.k() && this.hasEffect(MobEffectList.FIRE_RESISTANCE)) { @@ -711,12 +724,12 @@ public abstract class EntityLiving extends Entity { if (this.health <= 0) { if (flag) { - this.world.makeSound(this, this.aY(), this.aV(), this.h()); + this.makeSound(this.ba(), this.aX(), this.aV()); } this.die(damagesource); } else if (flag) { - this.world.makeSound(this, this.aX(), this.aV(), this.h()); + this.makeSound(this.aZ(), this.aX(), this.aV()); } return true; @@ -724,11 +737,11 @@ public abstract class EntityLiving extends Entity { } } - private float h() { + protected float aV() { return this.isBaby() ? (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.5F : (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F; } - public int aU() { + public int aW() { int i = 0; ItemStack[] aitemstack = this.getEquipment(); int j = aitemstack.length; @@ -750,7 +763,7 @@ public abstract class EntityLiving extends Entity { protected int b(DamageSource damagesource, int i) { if (!damagesource.ignoresArmor()) { - int j = 25 - this.aU(); + int j = 25 - this.aW(); int k = i * j + this.aS; this.k(i); @@ -775,26 +788,26 @@ public abstract class EntityLiving extends Entity { } protected void d(DamageSource damagesource, int i) { - if (!this.invulnerable) { + if (!this.isInvulnerable()) { i = this.b(damagesource, i); i = this.c(damagesource, i); this.health -= i; } } - protected float aV() { + protected float aX() { return 1.0F; } - protected String aW() { + protected String aY() { return null; } - protected String aX() { + protected String aZ() { return "damage.hit"; } - protected String aY() { + protected String ba() { return "damage.hit"; } @@ -907,9 +920,9 @@ public abstract class EntityLiving extends Entity { i = event.getDamage(); if (i > 4) { - this.world.makeSound(this, "damage.fallbig", 1.0F, 1.0F); + this.makeSound("damage.fallbig", 1.0F, 1.0F); } else { - this.world.makeSound(this, "damage.fallsmall", 1.0F, 1.0F); + this.makeSound("damage.fallsmall", 1.0F, 1.0F); } this.getBukkitEntity().setLastDamageCause(event); @@ -922,7 +935,7 @@ public abstract class EntityLiving extends Entity { if (j > 0) { StepSound stepsound = Block.byId[j].stepSound; - this.world.makeSound(this, stepsound.getName(), stepsound.getVolume1() * 0.5F, stepsound.getVolume2() * 0.75F); + this.makeSound(stepsound.getStepSound(), stepsound.getVolume1() * 0.5F, stepsound.getVolume2() * 0.75F); } } } @@ -932,7 +945,7 @@ public abstract class EntityLiving extends Entity { if (this.H() && (!(this instanceof EntityHuman) || !((EntityHuman) this).abilities.isFlying)) { d0 = this.locY; - this.a(f, f1, this.bb() ? 0.04F : 0.02F); + this.a(f, f1, this.be() ? 0.04F : 0.02F); this.move(this.motX, this.motY, this.motZ); this.motX *= 0.800000011920929D; this.motY *= 0.800000011920929D; @@ -968,8 +981,8 @@ public abstract class EntityLiving extends Entity { float f4; if (this.onGround) { - if (this.bb()) { - f4 = this.aE(); + if (this.be()) { + f4 = this.aF(); } else { f4 = this.aM; } @@ -1026,7 +1039,16 @@ public abstract class EntityLiving extends Entity { this.motY = 0.2D; } - this.motY -= 0.08D; + if (this.world.isStatic && (!this.world.isLoaded((int) this.locX, 0, (int) this.locZ) || !this.world.getChunkAtWorldCoords((int) this.locX, (int) this.locZ).d)) { + if (this.locY > 0.0D) { + this.motY = -0.1D; + } else { + this.motY = 0.0D; + } + } else { + this.motY -= 0.08D; + } + this.motY *= 0.9800000190734863D; this.motX *= (double) f2; this.motZ *= (double) f2; @@ -1055,11 +1077,9 @@ public abstract class EntityLiving extends Entity { } public void b(NBTTagCompound nbttagcompound) { - // CraftBukkit start if (this.health < -32768) { this.health = -32768; } - // CraftBukkit end nbttagcompound.setShort("Health", (short) this.health); nbttagcompound.setShort("HurtTime", (short) this.hurtTicks); @@ -1067,7 +1087,6 @@ public abstract class EntityLiving extends Entity { nbttagcompound.setShort("AttackTime", (short) this.attackTicks); nbttagcompound.setBoolean("CanPickUpLoot", this.canPickUpLoot); nbttagcompound.setBoolean("PersistenceRequired", this.persistent); - nbttagcompound.setBoolean("Invulnerable", this.invulnerable); NBTTagList nbttaglist = new NBTTagList(); for (int i = 0; i < this.equipment.length; ++i) { @@ -1116,7 +1135,6 @@ public abstract class EntityLiving extends Entity { this.attackTicks = nbttagcompound.getShort("AttackTime"); this.canPickUpLoot = nbttagcompound.getBoolean("CanPickUpLoot"); this.persistent = nbttagcompound.getBoolean("PersistenceRequired"); - this.invulnerable = nbttagcompound.getBoolean("Invulnerable"); NBTTagList nbttaglist; int i; @@ -1152,32 +1170,32 @@ public abstract class EntityLiving extends Entity { return !this.dead && this.health > 0; } - public boolean ba() { + public boolean bc() { return false; } public void f(float f) { - this.bE = f; + this.bC = f; } public void e(boolean flag) { - this.bG = flag; + this.bE = flag; } public void c() { - if (this.bW > 0) { - --this.bW; + if (this.bU > 0) { + --this.bU; } - if (this.bu > 0) { - double d0 = this.locX + (this.bv - this.locX) / (double) this.bu; - double d1 = this.locY + (this.bw - this.locY) / (double) this.bu; - double d2 = this.locZ + (this.bx - this.locZ) / (double) this.bu; - double d3 = MathHelper.g(this.by - (double) this.yaw); + if (this.bs > 0) { + double d0 = this.locX + (this.bt - this.locX) / (double) this.bs; + double d1 = this.locY + (this.bu - this.locY) / (double) this.bs; + double d2 = this.locZ + (this.bv - this.locZ) / (double) this.bs; + double d3 = MathHelper.g(this.bw - (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; + 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); } @@ -1195,19 +1213,19 @@ public abstract class EntityLiving extends Entity { } this.world.methodProfiler.a("ai"); - if (this.bd()) { - this.bG = false; + if (this.bg()) { + this.bE = false; + this.bB = 0.0F; + this.bC = 0.0F; this.bD = 0.0F; - this.bE = 0.0F; - this.bF = 0.0F; - } else if (this.bc()) { - if (this.bb()) { + } else if (this.bf()) { + if (this.be()) { this.world.methodProfiler.a("newAi"); - this.bi(); + this.bl(); this.world.methodProfiler.b(); } else { this.world.methodProfiler.a("oldAi"); - this.bk(); + this.bn(); this.world.methodProfiler.b(); this.ay = this.yaw; } @@ -1215,54 +1233,40 @@ public abstract class EntityLiving extends Entity { this.world.methodProfiler.b(); this.world.methodProfiler.a("jump"); - if (this.bG) { + if (this.bE) { if (!this.H() && !this.J()) { - if (this.onGround && this.bW == 0) { - this.bf(); - this.bW = 10; + if (this.onGround && this.bU == 0) { + this.bi(); + this.bU = 10; } } else { this.motY += 0.03999999910593033D; } } else { - this.bW = 0; + this.bU = 0; } this.world.methodProfiler.b(); this.world.methodProfiler.a("travel"); - this.bD *= 0.98F; - this.bE *= 0.98F; - this.bF *= 0.9F; + this.bB *= 0.98F; + this.bC *= 0.98F; + this.bD *= 0.9F; float f = this.aM; - this.aM *= this.by(); - this.e(this.bD, this.bE); + this.aM *= this.bB(); + this.e(this.bB, this.bC); this.aM = f; this.world.methodProfiler.b(); this.world.methodProfiler.a("push"); - List list; - Iterator iterator; - if (!this.world.isStatic) { - list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D)); - if (list != null && !list.isEmpty()) { - iterator = list.iterator(); - - while (iterator.hasNext()) { - Entity entity = (Entity) iterator.next(); - - if (entity.M()) { - this.n(entity); - } - } - } + this.bd(); } this.world.methodProfiler.b(); this.world.methodProfiler.a("looting"); - if (!this.world.isStatic && this.canPickUpLoot && this.world.getGameRules().getBoolean("mobGriefing")) { - list = this.world.a(EntityItem.class, this.boundingBox.grow(1.0D, 0.0D, 1.0D)); - iterator = list.iterator(); + if (!this.world.isStatic && this.canPickUpLoot && !this.bb && this.world.getGameRules().getBoolean("mobGriefing")) { + List list = this.world.a(EntityItem.class, this.boundingBox.grow(1.0D, 0.0D, 1.0D)); + Iterator iterator = list.iterator(); while (iterator.hasNext()) { EntityItem entityitem = (EntityItem) iterator.next(); @@ -1326,27 +1330,41 @@ public abstract class EntityLiving extends Entity { this.world.methodProfiler.b(); } - protected void n(Entity entity) { + protected void bd() { + List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D)); + + if (list != null && !list.isEmpty()) { + for (int i = 0; i < list.size(); ++i) { + Entity entity = (Entity) list.get(i); + + if (entity.M()) { + this.o(entity); + } + } + } + } + + protected void o(Entity entity) { entity.collide(this); } - protected boolean bb() { + protected boolean be() { return false; } - protected boolean bc() { + protected boolean bf() { return !this.world.isStatic; } - protected boolean bd() { + protected boolean bg() { return this.health <= 0; } - public boolean be() { + public boolean bh() { return false; } - protected void bf() { + protected void bi() { this.motY = 0.41999998688697815D; if (this.hasEffect(MobEffectList.JUMP)) { this.motY += (double) ((float) (this.getEffect(MobEffectList.JUMP).getAmplifier() + 1) * 0.1F); @@ -1362,11 +1380,11 @@ public abstract class EntityLiving extends Entity { this.am = true; } - protected boolean bg() { + protected boolean bj() { return true; } - protected void bh() { + protected void bk() { if (!this.persistent) { EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D); @@ -1376,26 +1394,26 @@ public abstract class EntityLiving extends Entity { double d2 = entityhuman.locZ - this.locZ; double d3 = d0 * d0 + d1 * d1 + d2 * d2; - if (this.bg() && d3 > 16384.0D) { + if (this.bj() && d3 > 16384.0D) { this.die(); } - if (this.bC > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D && this.bg()) { + if (this.bA > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D && this.bj()) { this.die(); } else if (d3 < 1024.0D) { - this.bC = 0; + this.bA = 0; } } } } - protected void bi() { - ++this.bC; + protected void bl() { + ++this.bA; this.world.methodProfiler.a("checkDespawn"); - this.bh(); + this.bk(); this.world.methodProfiler.b(); this.world.methodProfiler.a("sensing"); - this.bP.a(); + this.bN.a(); this.world.methodProfiler.b(); this.world.methodProfiler.a("targetSelector"); this.targetSelector.a(); @@ -1407,7 +1425,7 @@ public abstract class EntityLiving extends Entity { this.navigation.e(); this.world.methodProfiler.b(); this.world.methodProfiler.a("mob tick"); - this.bj(); + this.bm(); this.world.methodProfiler.b(); this.world.methodProfiler.a("controls"); this.world.methodProfiler.a("move"); @@ -1420,65 +1438,65 @@ public abstract class EntityLiving extends Entity { this.world.methodProfiler.b(); } - protected void bj() {} + protected void bm() {} - protected void bk() { - ++this.bC; - this.bh(); - this.bD = 0.0F; - this.bE = 0.0F; + protected void bn() { + ++this.bA; + this.bk(); + this.bB = 0.0F; + this.bC = 0.0F; float f = 8.0F; if (this.random.nextFloat() < 0.02F) { EntityHuman entityhuman = this.world.findNearbyPlayer(this, (double) f); if (entityhuman != null) { - this.bX = entityhuman; - this.bJ = 10 + this.random.nextInt(20); + this.bV = entityhuman; + this.bH = 10 + this.random.nextInt(20); } else { - this.bF = (this.random.nextFloat() - 0.5F) * 20.0F; + this.bD = (this.random.nextFloat() - 0.5F) * 20.0F; } } - if (this.bX != null) { - this.a(this.bX, 10.0F, (float) this.bm()); - if (this.bJ-- <= 0 || this.bX.dead || this.bX.e((Entity) this) > (double) (f * f)) { - this.bX = null; + if (this.bV != null) { + this.a(this.bV, 10.0F, (float) this.bp()); + if (this.bH-- <= 0 || this.bV.dead || this.bV.e((Entity) this) > (double) (f * f)) { + this.bV = null; } } else { if (this.random.nextFloat() < 0.05F) { - this.bF = (this.random.nextFloat() - 0.5F) * 20.0F; + this.bD = (this.random.nextFloat() - 0.5F) * 20.0F; } - this.yaw += this.bF; - this.pitch = this.bH; + this.yaw += this.bD; + this.pitch = this.bF; } boolean flag = this.H(); boolean flag1 = this.J(); if (flag || flag1) { - this.bG = this.random.nextFloat() < 0.8F; + this.bE = this.random.nextFloat() < 0.8F; } } - protected void bl() { - int i = this.i(); + protected void bo() { + int i = this.h(); - if (this.bq) { - ++this.br; - if (this.br >= i) { - this.br = 0; - this.bq = false; + if (this.bp) { + ++this.bq; + if (this.bq >= i) { + this.bq = 0; + this.bp = false; } } else { - this.br = 0; + this.bq = 0; } - this.aP = (float) this.br / (float) i; + this.aP = (float) this.bq / (float) i; } - public int bm() { + public int bp() { return 40; } @@ -1563,7 +1581,7 @@ public abstract class EntityLiving extends Entity { } } - public int bs() { + public int bv() { return 4; } @@ -1571,16 +1589,20 @@ public abstract class EntityLiving extends Entity { return false; } - protected void bu() { + protected void bx() { Iterator iterator = this.effects.keySet().iterator(); while (iterator.hasNext()) { Integer integer = (Integer) iterator.next(); MobEffect mobeffect = (MobEffect) this.effects.get(integer); - if (!mobeffect.tick(this) && !this.world.isStatic) { - iterator.remove(); - this.c(mobeffect); + if (!mobeffect.tick(this)) { + if (!this.world.isStatic) { + iterator.remove(); + this.c(mobeffect); + } + } else if (mobeffect.getDuration() % 600 == 0) { + this.b(mobeffect); } } @@ -1629,7 +1651,7 @@ public abstract class EntityLiving extends Entity { } } - public void bv() { + public void by() { Iterator iterator = this.effects.keySet().iterator(); while (iterator.hasNext()) { @@ -1683,7 +1705,7 @@ public abstract class EntityLiving extends Entity { return true; } - public boolean bx() { + public boolean bA() { return this.getMonsterType() == EnumMonsterType.UNDEAD; } @@ -1707,7 +1729,7 @@ public abstract class EntityLiving extends Entity { this.updateEffects = true; } - public float by() { + public float bB() { float f = 1.0F; if (this.hasEffect(MobEffectList.FASTER_MOVEMENT)) { @@ -1734,7 +1756,7 @@ public abstract class EntityLiving extends Entity { } public void a(ItemStack itemstack) { - this.world.makeSound(this, "random.break", 0.8F, 0.8F + this.world.random.nextFloat() * 0.4F); + this.makeSound("random.break", 0.8F, 0.8F + this.world.random.nextFloat() * 0.4F); for (int i = 0; i < 5; ++i) { Vec3D vec3d = this.world.getVec3DPool().create(((double) this.random.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D); @@ -1751,7 +1773,7 @@ public abstract class EntityLiving extends Entity { } public int as() { - if (this.aF() == null) { + if (this.aG() == null) { return 3; } else { int i = (int) ((float) this.health - (float) this.getMaxHealth() * 0.33F); @@ -1765,7 +1787,7 @@ public abstract class EntityLiving extends Entity { } } - public ItemStack bA() { + public ItemStack bD() { return this.equipment[0]; } @@ -1811,7 +1833,7 @@ public abstract class EntityLiving extends Entity { } } - protected void bB() { + protected void bE() { if (this.random.nextFloat() < d[this.world.difficulty]) { int i = this.random.nextInt(2); float f = this.world.difficulty == 3 ? 0.1F : 0.25F; @@ -1851,15 +1873,15 @@ public abstract class EntityLiving extends Entity { EntityTracker entitytracker = ((WorldServer) this.world).getTracker(); if (entity instanceof EntityItem) { - entitytracker.a(entity, new Packet22Collect(entity.id, this.id)); + entitytracker.a(entity, (Packet) (new Packet22Collect(entity.id, this.id))); } if (entity instanceof EntityArrow) { - entitytracker.a(entity, new Packet22Collect(entity.id, this.id)); + entitytracker.a(entity, (Packet) (new Packet22Collect(entity.id, this.id))); } if (entity instanceof EntityExperienceOrb) { - entitytracker.a(entity, new Packet22Collect(entity.id, this.id)); + entitytracker.a(entity, (Packet) (new Packet22Collect(entity.id, this.id))); } } } @@ -1947,9 +1969,9 @@ public abstract class EntityLiving extends Entity { } } - protected void bC() { - if (this.bA() != null && this.random.nextFloat() < b[this.world.difficulty]) { - EnchantmentManager.a(this.random, this.bA(), 5); + protected void bF() { + if (this.bD() != null && this.random.nextFloat() < b[this.world.difficulty]) { + EnchantmentManager.a(this.random, this.bD(), 5); } for (int i = 0; i < 4; ++i) { @@ -1961,23 +1983,31 @@ public abstract class EntityLiving extends Entity { } } - public void bD() {} + public void bG() {} - private int i() { + private int h() { return this.hasEffect(MobEffectList.FASTER_DIG) ? 6 - (1 + this.getEffect(MobEffectList.FASTER_DIG).getAmplifier()) * 1 : (this.hasEffect(MobEffectList.SLOWER_DIG) ? 6 + (1 + this.getEffect(MobEffectList.SLOWER_DIG).getAmplifier()) * 2 : 6); } - public void bE() { - if (!this.bq || this.br >= this.i() / 2 || this.br < 0) { - this.br = -1; - this.bq = true; + public void bH() { + if (!this.bp || this.bq >= this.h() / 2 || this.bq < 0) { + this.bq = -1; + this.bp = true; if (this.world instanceof WorldServer) { - ((WorldServer) this.world).getTracker().a(this, new Packet18ArmAnimation(this, 1)); + ((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new Packet18ArmAnimation(this, 1))); } } } - public boolean bF() { + public boolean bI() { return false; } + + public final int bJ() { + return this.datawatcher.getByte(10); + } + + public final void r(int i) { + this.datawatcher.watch(10, Byte.valueOf((byte) i)); + } } |