public ItemStack func_82787_a(InventoryCrafting p_82787_1_, World p_82787_2_) {
    int var3 = 0;
    ItemStack var4 = null;
    ItemStack var5 = null;

    int var6;
    for (var6 = 0; var6 < p_82787_1_.func_70302_i_(); ++var6) {
      ItemStack var7 = p_82787_1_.func_70301_a(var6);
      if (var7 != null) {
        if (var3 == 0) {
          var4 = var7;
        }

        if (var3 == 1) {
          var5 = var7;
        }

        ++var3;
      }
    }

    if (var3 == 2
        && var4.field_77993_c == var5.field_77993_c
        && var4.field_77994_a == 1
        && var5.field_77994_a == 1
        && Item.field_77698_e[var4.field_77993_c].func_77645_m()) {
      Item var11 = Item.field_77698_e[var4.field_77993_c];
      int var13 = var11.func_77612_l() - var4.func_77952_i();
      int var8 = var11.func_77612_l() - var5.func_77952_i();
      int var9 = var13 + var8 + var11.func_77612_l() * 5 / 100;
      int var10 = var11.func_77612_l() - var9;
      if (var10 < 0) {
        var10 = 0;
      }

      return new ItemStack(var4.field_77993_c, 1, var10);
    } else {
      for (var6 = 0; var6 < this.field_77597_b.size(); ++var6) {
        IRecipe var12 = (IRecipe) this.field_77597_b.get(var6);
        if (var12.func_77569_a(p_82787_1_, p_82787_2_)) {
          return var12.func_77572_b(p_82787_1_);
        }
      }

      return null;
    }
  }
Example #2
0
 @SuppressWarnings("unchecked")
 public static void addEmeraldSellRecipe(
     EntityVillager villager,
     MerchantRecipeList list,
     Random random,
     Item item,
     float chance,
     int min,
     int max) {
   if (min > 0 && max > 0) {
     EntityVillager.field_70960_bC.put(item.field_77779_bT, new Tuple(min, max));
   }
   EntityVillager.func_70949_b(list, item.func_77612_l(), random, chance);
 }