public void func_176162_a(IBlockAccess p_176162_1_, Entity p_176162_2_) { this.field_176169_a = p_176162_1_; this.field_176167_b.clearMap(); this.field_176168_c = MathHelper.floor_float(p_176162_2_.width + 1.0F); this.field_176165_d = MathHelper.floor_float(p_176162_2_.height + 1.0F); this.field_176166_e = MathHelper.floor_float(p_176162_2_.width + 1.0F); }
/** Updates the task */ public void updateTask() { double var1 = this.entityHost.getDistanceSq( this.attackTarget.posX, this.attackTarget.getEntityBoundingBox().minY, this.attackTarget.posZ); boolean var3 = this.entityHost.getEntitySenses().canSee(this.attackTarget); if (var3) { ++this.field_75318_f; } else { this.field_75318_f = 0; } if (var1 <= (double) this.maxAttackDistance && this.field_75318_f >= 20) { this.entityHost.getNavigator().clearPathEntity(); } else { this.entityHost.getNavigator().tryMoveToEntityLiving(this.attackTarget, this.entityMoveSpeed); } this.entityHost.getLookHelper().setLookPositionWithEntity(this.attackTarget, 30.0F, 30.0F); float var4; if (--this.rangedAttackTime == 0) { if (var1 > (double) this.maxAttackDistance || !var3) { return; } var4 = MathHelper.sqrt_double(var1) / this.field_96562_i; float var5 = MathHelper.clamp_float(var4, 0.1F, 1.0F); this.rangedAttackEntityHost.attackEntityWithRangedAttack(this.attackTarget, var5); this.rangedAttackTime = MathHelper.floor_float( var4 * (float) (this.maxRangedAttackTime - this.field_96561_g) + (float) this.field_96561_g); } else if (this.rangedAttackTime < 0) { var4 = MathHelper.sqrt_double(var1) / this.field_96562_i; this.rangedAttackTime = MathHelper.floor_float( var4 * (float) (this.maxRangedAttackTime - this.field_96561_g) + (float) this.field_96561_g); } }