public ItemStack findMatchingRecipe(InventoryCrafting inventorycrafting) {
    for (int i = 0; i < recipes.size(); i++) {
      IRecipe irecipe = (IRecipe) recipes.get(i);
      if (irecipe.matches(inventorycrafting)) {
        return irecipe.getCraftingResult(inventorycrafting);
      }
    }

    return null;
  }
예제 #2
0
  public ItemStack findMatchingRecipe(InventoryCrafting inventorycrafting) {
    int i = 0;
    ItemStack itemstack = null;
    ItemStack itemstack1 = null;
    for (int j = 0; j < inventorycrafting.getSizeInventory(); j++) {
      ItemStack itemstack2 = inventorycrafting.getStackInSlot(j);
      if (itemstack2 == null) {
        continue;
      }
      if (i == 0) {
        itemstack = itemstack2;
      }
      if (i == 1) {
        itemstack1 = itemstack2;
      }
      i++;
    }

    if (i == 2
        && itemstack.itemID == itemstack1.itemID
        && itemstack.stackSize == 1
        && itemstack1.stackSize == 1
        && Item.itemsList[itemstack.itemID].isDamageable()) {
      Item item = Item.itemsList[itemstack.itemID];
      int l = item.getMaxDamage() - itemstack.getItemDamageForDisplay();
      int i1 = item.getMaxDamage() - itemstack1.getItemDamageForDisplay();
      int j1 = l + i1 + (item.getMaxDamage() * 10) / 100;
      int k1 = item.getMaxDamage() - j1;
      if (k1 < 0) {
        k1 = 0;
      }
      return new ItemStack(itemstack.itemID, 1, k1);
    }
    for (int k = 0; k < recipes.size(); k++) {
      IRecipe irecipe = (IRecipe) recipes.get(k);
      if (irecipe.matches(inventorycrafting)) {
        return irecipe.getCraftingResult(inventorycrafting);
      }
    }

    return null;
  }
예제 #3
0
  public static void func_25091_c() {
    if (!field_25101_D || !field_25099_E) {
      return;
    }
    HashSet hashset = new HashSet();
    IRecipe irecipe;
    for (Iterator iterator = CraftingManager.getInstance().getRecipeList().iterator();
        iterator.hasNext();
        hashset.add(Integer.valueOf(irecipe.func_25077_b().itemID))) {
      irecipe = (IRecipe) iterator.next();
    }

    ItemStack itemstack;
    for (Iterator iterator1 = FurnaceRecipes.smelting().getSmeltingList().values().iterator();
        iterator1.hasNext();
        hashset.add(Integer.valueOf(itemstack.itemID))) {
      itemstack = (ItemStack) iterator1.next();
    }

    field_25093_z = new StatBase[32000];
    Iterator iterator2 = hashset.iterator();
    do {
      if (!iterator2.hasNext()) {
        break;
      }
      Integer integer = (Integer) iterator2.next();
      if (Item.itemsList[integer.intValue()] != null) {
        String s =
            StatCollector.translateToLocalFormatted(
                "stat.craftItem", new Object[] {Item.itemsList[integer.intValue()].func_25006_i()});
        field_25093_z[integer.intValue()] =
            (new StatCrafting(0x1010000 + integer.intValue(), s, integer.intValue()))
                .func_27053_d();
      }
    } while (true);
    replaceAllSimilarBlocks(field_25093_z);
  }