예제 #1
0
 public float getMultiplierForInput(ItemStack input, Fluid output) {
   if (output != null) {
     for (IRecipe recipe : recipes) {
       RecipeOutput out = recipe.getOutputs()[0];
       if (out.getFluidOutput().getFluid().getID() == output.getID()) {
         for (RecipeInput ri : recipe.getInputs()) {
           if (ri.isInput(input)) {
             return ri.getMulitplier();
           }
         }
       }
     }
   }
   // no fluid or not an input for this fluid: best guess
   // (after all, the item IS in the input slot)
   float found = -1f;
   for (IRecipe recipe : recipes) {
     for (RecipeInput ri : recipe.getInputs()) {
       if (ri.isInput(input)) {
         if (found < 0f || found > ri.getMulitplier()) {
           found = ri.getMulitplier();
         }
       }
     }
   }
   return found > 0 ? found : 0;
 }
  @Override
  public List<IEnderIoRecipe> getAllRecipes() {
    List<IEnderIoRecipe> result = new ArrayList<IEnderIoRecipe>();
    List<IAlloyRecipe> recipes = AlloyRecipeManager.getInstance().getRecipes();
    for (IRecipe cr : recipes) {
      List<IRecipeComponent> components = new ArrayList<IRecipeComponent>();
      for (crazypants.enderio.machine.recipe.RecipeInput ri : cr.getInputs()) {
        if (ri.getInput() != null) {
          IRecipeInput input = new RecipeInput(ri.getInput(), -1, ri.getEquivelentInputs());
          components.add(input);
        }
      }

      for (RecipeOutput co : cr.getOutputs()) {
        IRecipeOutput output =
            new crazypants.enderio.crafting.impl.RecipeOutput(co.getOutput(), co.getChance());
        components.add(output);
      }
      result.add(
          new EnderIoRecipe(IEnderIoRecipe.ALLOY_SMELTER_ID, cr.getEnergyRequired(), components));
    }
    return result;
  }