public ItemStack func_82846_b(EntityPlayer p_82846_1_, int p_82846_2_) {
    ItemStack var3 = null;
    Slot var4 = (Slot) this.field_75151_b.get(p_82846_2_);
    if (var4 != null && var4.func_75216_d()) {
      ItemStack var5 = var4.func_75211_c();
      var3 = var5.func_77946_l();
      if (p_82846_2_ == 2) {
        if (!this.func_75135_a(var5, 3, 39, true)) {
          return null;
        }

        var4.func_75220_a(var5, var3);
      } else if (p_82846_2_ != 1 && p_82846_2_ != 0) {
        if (FurnaceRecipes.func_77602_a().func_77603_b(var5.func_77973_b().field_77779_bT)
            != null) {
          if (!this.func_75135_a(var5, 0, 1, false)) {
            return null;
          }
        } else if (TileEntityFurnace.func_70401_b(var5)) {
          if (!this.func_75135_a(var5, 1, 2, false)) {
            return null;
          }
        } else if (p_82846_2_ >= 3 && p_82846_2_ < 30) {
          if (!this.func_75135_a(var5, 30, 39, false)) {
            return null;
          }
        } else if (p_82846_2_ >= 30 && p_82846_2_ < 39 && !this.func_75135_a(var5, 3, 30, false)) {
          return null;
        }
      } else if (!this.func_75135_a(var5, 3, 39, false)) {
        return null;
      }

      if (var5.field_77994_a == 0) {
        var4.func_75215_d((ItemStack) null);
      } else {
        var4.func_75218_e();
      }

      if (var5.field_77994_a == var3.field_77994_a) {
        return null;
      }

      var4.func_82870_a(p_82846_1_, var5);
    }

    return var3;
  }
  public ItemStack func_82846_b(EntityPlayer p_82846_1_, int p_82846_2_) {
    ItemStack var3 = null;
    Slot var4 = (Slot) this.field_75151_b.get(p_82846_2_);
    if (var4 != null && var4.func_75216_d()) {
      ItemStack var5 = var4.func_75211_c();
      var3 = var5.func_77946_l();
      if (p_82846_2_ < this.field_75154_f * 9) {
        if (!this.func_75135_a(var5, this.field_75154_f * 9, this.field_75151_b.size(), true)) {
          return null;
        }
      } else if (!this.func_75135_a(var5, 0, this.field_75154_f * 9, false)) {
        return null;
      }

      if (var5.field_77994_a == 0) {
        var4.func_75215_d((ItemStack) null);
      } else {
        var4.func_75218_e();
      }
    }

    return var3;
  }