public void a(MerchantRecipe merchantrecipe) {
   merchantrecipe.f();
   a_ = -q();
   makeSound("mob.villager.yes", bf(), bg());
   if (merchantrecipe.a((MerchantRecipe) bu.get(bu.size() - 1))) {
     bv = 40;
     bw = true;
     if (tradingPlayer != null) by = tradingPlayer.getName();
     else by = null;
   }
   if (merchantrecipe.getBuyItem1().getItem() == Items.EMERALD)
     riches += merchantrecipe.getBuyItem1().count;
 }
 protected void bp() {
   if (--profession <= 0) {
     world.villages.a(MathHelper.floor(locX), MathHelper.floor(locY), MathHelper.floor(locZ));
     profession = 70 + random.nextInt(50);
     village =
         world.villages.getClosestVillage(
             MathHelper.floor(locX), MathHelper.floor(locY), MathHelper.floor(locZ), 32);
     if (village == null) {
       bV();
     } else {
       ChunkCoordinates chunkcoordinates = village.getCenter();
       a(
           chunkcoordinates.x,
           chunkcoordinates.y,
           chunkcoordinates.z,
           (int) ((float) village.getSize() * 0.6F));
       if (bz) {
         bz = false;
         village.b(5);
       }
     }
   }
   if (!ca() && bv > 0) {
     bv--;
     if (bv <= 0) {
       if (bw) {
         if (bu.size() > 1) {
           Iterator iterator = bu.iterator();
           do {
             if (!iterator.hasNext()) break;
             MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next();
             if (merchantrecipe.g()) merchantrecipe.a(random.nextInt(6) + random.nextInt(6) + 2);
           } while (true);
         }
         t(1);
         bw = false;
         if (village != null && by != null) {
           world.broadcastEntityEffect(this, (byte) 14);
           village.a(by, 1);
         }
       }
       addEffect(new MobEffect(MobEffectList.REGENERATION.id, 200, 0));
     }
   }
   super.bp();
 }