Esempio n. 1
0
  public static Item createPipe(
      int defaultID,
      Class<? extends Pipe> clas,
      String descr,
      Object ingredient1,
      Object ingredient2,
      Object ingredient3) {
    String name =
        Character.toLowerCase(clas.getSimpleName().charAt(0)) + clas.getSimpleName().substring(1);

    Property prop = BuildCraftCore.mainConfiguration.getItem(name + ".id", defaultID);

    int id = prop.getInt(defaultID);
    ItemPipe res = BlockGenericPipe.registerPipe(id, clas);
    res.setItemName(clas.getSimpleName());
    LanguageRegistry.addName(res, descr);

    // Add appropriate recipe to temporary list
    PipeRecipe recipe = new PipeRecipe();

    if (ingredient1 != null && ingredient2 != null && ingredient3 != null) {
      recipe.result = new ItemStack(res, 8);
      recipe.input =
          new Object[] {
            "ABC",
            Character.valueOf('A'),
            ingredient1,
            Character.valueOf('B'),
            ingredient2,
            Character.valueOf('C'),
            ingredient3
          };

      pipeRecipes.add(recipe);
    } else if (ingredient1 != null && ingredient2 != null) {
      recipe.isShapeless = true;
      recipe.result = new ItemStack(res, 1);
      recipe.input = new Object[] {ingredient1, ingredient2};

      pipeRecipes.add(recipe);
    }

    return res;
  }