@Override
 public void loadUsageRecipes(ItemStack ingredient) {
   for (Map.Entry<PressurizedInput, PressurizedRecipe> irecipe : getRecipes()) {
     if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getKey().getSolid(), ingredient)) {
       arecipes.add(new CachedIORecipe(irecipe));
     }
   }
 }
 @Override
 public void loadCraftingRecipes(ItemStack result) {
   for (final Map.Entry<PositionedStack, PositionedStack> irecipe : this.getRecipes()) {
     if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getValue().item, result)) {
       this.arecipes.add(new CachedRefineryRecipe(irecipe));
     }
   }
 }
 @Override
 public void loadCraftingRecipes(ItemStack result) {
   for (Map.Entry<PressurizedInput, PressurizedRecipe> irecipe : getRecipes()) {
     if (NEIServerUtils.areStacksSameTypeCrafting(
         irecipe.getValue().getOutput().getItemOutput(), result)) {
       arecipes.add(new CachedIORecipe(irecipe));
     }
   }
 }
 @Override
 public void loadUsageRecipes(ItemStack ingredient) {
   for (final Map.Entry<PositionedStack, PositionedStack> irecipe : this.getRecipes()) {
     if (NEIServerUtils.areStacksSameTypeCrafting(ingredient, irecipe.getKey().item)) {
       this.arecipes.add(new CachedRefineryRecipe(irecipe));
       break;
     }
   }
 }
 @Override
 public void loadUsageRecipes(ItemStack ingredient) {
   for (String name : Carving.chisel.getSortedGroupNames()) {
     ICarvingGroup g = Carving.chisel.getGroup(name);
     List<ItemStack> variations = getVariationStacks(g);
     for (ItemStack stack : variations) {
       if (NEIServerUtils.areStacksSameTypeCrafting(stack, ingredient)) {
         addCached(variations, ingredient, null);
       }
     }
   }
 }
 @Override
 public void loadCraftingRecipes(ItemStack result) {
   for (MetallurgicInfuserRecipe irecipe : getRecipes()) {
     if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getOutput().output, result)) {
       arecipes.add(
           new CachedIORecipe(
               irecipe,
               getInfuseStacks(irecipe.getInput().infuse.type),
               irecipe.getInput().infuse.type));
     }
   }
 }
  @Override
  public void loadUsageRecipes(ItemStack ingredient) {
    for (MetallurgicInfuserRecipe irecipe : getRecipes()) {
      if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getInput().inputStack, ingredient)) {
        arecipes.add(
            new CachedIORecipe(
                irecipe,
                getInfuseStacks(irecipe.getInput().infuse.type),
                irecipe.getInput().infuse.type));
      }

      List<ItemStack> infuses;

      for (ItemStack stack : getInfuseStacks(irecipe.getInput().infuse.type)) {
        if (NEIServerUtils.areStacksSameTypeCrafting(stack, ingredient)) {
          infuses = new ArrayList<ItemStack>();
          infuses.add(stack);
          arecipes.add(new CachedIORecipe(irecipe, infuses, irecipe.getInput().infuse.type));
        }
      }
    }
  }
Beispiel #8
0
  public void updateEnchantmentOptions() {
    int numoptions = slotEnchantment.size();
    slotEnchantment.clear();

    ItemStack toolstack = getSlot(0).getStack();
    if (toolstack == null) {
      percentscrolled = 0;
      return;
    }

    boolean validate = NEIClientConfig.validateEnchantments();

    Item item = toolstack.getItem();
    int enchantablity = item.getItemEnchantability();
    if (enchantablity == 0 && validate) {
      percentscrolled = 0;
      return;
    }

    for (Enchantment e : Enchantment.enchantmentsList) {
      if (e == null || e.type == null || (!e.type.canEnchantItem(item) && validate)) {
        continue;
      }
      int state = 0;
      int level = -1;
      if (NEIServerUtils.stackHasEnchantment(toolstack, e.effectId)) {
        state = 2;
        level = NEIServerUtils.getEnchantmentLevel(toolstack, e.effectId);
      } else if (NEIServerUtils.doesEnchantmentConflict(
              NEIServerUtils.getEnchantments(toolstack), e)
          && validate) {
        state = 1;
      }
      slotEnchantment.add(new EnchantmentHash(e, state, level));
    }
    if (numoptions != slotEnchantment.size()) {
      percentscrolled = 0;
    }
  }
 @Override
 public void loadCraftingRecipes(ItemStack result) {
   for (Map.Entry irecipe : getRecipes()) {
     if (NEIServerUtils.areStacksSameTypeCrafting(
         ((InfusionOutput) irecipe.getValue()).resource, result)) {
       arecipes.add(
           new CachedIORecipe(
               irecipe,
               getInfuseStacks(((InfusionInput) irecipe.getKey()).infusionType),
               ((InfusionInput) irecipe.getKey()).infusionType));
     }
   }
 }
 @Override
 public void loadUsageRecipes(ItemStack ingredient) {
   for (Map.Entry irecipe : getRecipes()) {
     if (NEIServerUtils.areStacksSameTypeCrafting(
         ((InfusionInput) irecipe.getKey()).inputStack, ingredient)) {
       arecipes.add(
           new CachedIORecipe(
               irecipe,
               getInfuseStacks(((InfusionInput) irecipe.getKey()).infusionType),
               ((InfusionInput) irecipe.getKey()).infusionType));
     }
     List<ItemStack> infuses;
     for (ItemStack stack : getInfuseStacks(((InfusionInput) irecipe.getKey()).infusionType)) {
       if (NEIServerUtils.areStacksSameTypeCrafting(stack, ingredient)) {
         infuses = new ArrayList<ItemStack>();
         infuses.add(stack);
         arecipes.add(
             new CachedIORecipe(
                 irecipe, infuses, ((InfusionInput) irecipe.getKey()).infusionType));
       }
     }
   }
 }
 private static List<ItemStack> getVariationStacks(ICarvingGroup g) {
   List<ItemStack> stacks = new ArrayList<ItemStack>();
   for (ICarvingVariation v : g.getVariations()) {
     stacks.add(CarvingUtils.getStack(v));
   }
   String oreName = g.getOreName();
   if (oreName != null) {
     check:
     for (ItemStack ore : OreDictionary.getOres(oreName)) {
       for (ItemStack stack : stacks) {
         if (NEIServerUtils.areStacksSameTypeCrafting(stack, ore)) {
           continue check;
         }
       }
       stacks.add(ore.copy());
     }
   }
   return stacks;
 }
  @Override
  public void loadCraftingRecipes(ItemStack result) {
    List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
    for (IRecipe irecipe : allrecipes) {
      if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) {
        CachedShapelessRecipe recipe = null;
        if (irecipe instanceof ShapelessRecipes) {
          recipe = shapelessRecipe((ShapelessRecipes) irecipe);
        } else if (irecipe instanceof ShapelessOreRecipe) {
          recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
        }

        if (recipe == null) {
          continue;
        }

        arecipes.add(recipe);
      }
    }
  }
    public CachedChiselRecipe(List<ItemStack> variations, ItemStack base, ItemStack focus) {
      PositionedStack pStack = new PositionedStack(base != null ? base : variations, 74, 4);
      pStack.setMaxSize(1);
      this.input.add(pStack);

      int row = 0;
      int col = 0;
      for (ItemStack v : variations) {
        this.outputs.add(new PositionedStack(v, 3 + 18 * col, 37 + 18 * row));

        if (focus != null && NEIServerUtils.areStacksSameTypeCrafting(focus, v)) {
          this.focus = new Point(2 + 18 * col, 36 + 18 * row);
        }

        col++;
        if (col > 8) {
          col = 0;
          row++;
        }
      }
    }