コード例 #1
0
  @Override
  public void loadCraftingRecipes(String outputId, Object... results) {
    if (outputId.equals("DCsHeatSource") && getClass() == HeatSourceHandler.class) {
      List<ICookingHeatSource> recipes = this.recipeLoader();

      if (recipes == null || recipes.isEmpty()) return;
      for (ICookingHeatSource recipe : recipes) {
        Block block = recipe.getBlock();
        int m = recipe.getMetadata();
        boolean a = RecipeRegisterManager.plateRecipe.isHeatSource(block, m);
        boolean b = RecipeRegisterManager.panRecipe.isHeatSource(block, m);
        arecipes.add(new HeatRecipeCacher(new ItemStack(block, 1, m), a, b));
      }
    } else {
      super.loadCraftingRecipes(outputId, results);
    }
  }
コード例 #2
0
  @Override
  public void loadUsageRecipes(ItemStack ingredient) {
    List<ICookingHeatSource> recipes = this.recipeLoader();

    if (recipes == null || recipes.isEmpty()) return;
    for (ICookingHeatSource recipe : recipes) {
      Block block = recipe.getBlock();
      int m = recipe.getMetadata();
      ItemStack item = new ItemStack(block, 1, m);
      boolean a = RecipeRegisterManager.plateRecipe.isHeatSource(block, m);
      boolean b = RecipeRegisterManager.panRecipe.isHeatSource(block, m);
      if (ingredient.getItem() == item.getItem()
          && ingredient.getItemDamage() == item.getItemDamage()) {
        arecipes.add(new HeatRecipeCacher(ingredient, a, b));
      } else if (ingredient.getItem() == Item.getItemFromBlock(DCsAppleMilk.teppanII)) {
        arecipes.add(new HeatRecipeCacher(item, a, b));
      } else if (ingredient.getItem() == Item.getItemFromBlock(DCsAppleMilk.emptyPanGaiden)) {
        arecipes.add(new HeatRecipeCacher(item, a, b));
      }
    }
  }
コード例 #3
0
  private List<ICookingHeatSource> recipeLoader() {
    sources = new ArrayList<ICookingHeatSource>();
    List<ICookingHeatSource> list = new ArrayList<ICookingHeatSource>();
    if (RecipeRegisterManager.plateRecipe.getHeatSourcesList() != null
        && !RecipeRegisterManager.plateRecipe.getHeatSourcesList().isEmpty()) {
      list.addAll(
          (List<ICookingHeatSource>) RecipeRegisterManager.plateRecipe.getHeatSourcesList());
    }
    if (RecipeRegisterManager.panRecipe.getHeatSourcesList() != null
        && !RecipeRegisterManager.panRecipe.getHeatSourcesList().isEmpty()) {

      list.addAll((List<ICookingHeatSource>) RecipeRegisterManager.panRecipe.getHeatSourcesList());
    }

    if (!list.isEmpty()) {
      for (ICookingHeatSource c : list) {
        boolean b = true;
        for (ICookingHeatSource t : sources) {
          if (t.getBlock() == null) continue;
          if (t.getBlock() == c.getBlock() && t.getMetadata() == c.getMetadata()) {
            b = false;
          }
        }
        if (b) {
          sources.add(c);
        }
      }
    }

    return this.sources;
  }