Exemplo n.º 1
0
  public ItemStack getOutputForDisplay() {
    EnumMetal metal = EnumMetal.COPPER;

    switch (this) {
      case ANVIL:
        return ItemAnvilVC.withMetal(metal);
      case ANVIL_BASE:
        return ItemAnvilPart.setMetal(new ItemStack(ItemsVC.anvilbase), metal);
      case ANVIL_SURFACE:
        return ItemAnvilPart.setMetal(new ItemStack(ItemsVC.anvilsurface), metal);
      case AXE:
        return new ItemStack(ItemsVC.tools.get(metal.getName() + "_axe"));
      case PICKAXE:
        return new ItemStack(ItemsVC.tools.get(metal.getName() + "_pickaxe"));
      case HAMMER:
        return new ItemStack(ItemsVC.tools.get(metal.getName() + "_hammer"));
      case HOE:
        return new ItemStack(ItemsVC.tools.get(metal.getName() + "_hoe"));
      case SAW:
        return new ItemStack(ItemsVC.tools.get(metal.getName() + "_saw"));
      case SHOVEL:
        return new ItemStack(ItemsVC.tools.get(metal.getName() + "_shovel"));
      case SWORD:
        return new ItemStack(ItemsVC.tools.get(metal.getName() + "_sword"));
      case SHEARS:
        return new ItemStack(ItemsVC.tools.get(metal.getName() + "_" + "shears"));
      case SICKLE:
        return new ItemStack(ItemsVC.tools.get(metal.getName() + "_" + "sickle"));

      case PLATE:
        return BlocksVC.metalplate.getItemStackFor(metal);
      case HELMET:
        return new ItemStack(ItemsVC.armor.get(metal.getName() + "_helmet"));
      case CHESTPLATE:
        return new ItemStack(ItemsVC.armor.get(metal.getName() + "_chestplate"));
      case LEGGINGS:
        return new ItemStack(ItemsVC.armor.get(metal.getName() + "_leggings"));
      case BOOTS:
        return new ItemStack(ItemsVC.armor.get(metal.getName() + "_boots"));

      case FIX_INGOT:
        return ItemIngot.setMetal(new ItemStack(ItemsVC.metalingot), metal);
      case FIX_PLATE:
        return BlocksVC.metalplate.getItemStackFor(metal);
      case COKEOVENDOOR:
        return new ItemStack(BlocksVC.cokeovendoor);
      default:
    }

    return null;
  }
Exemplo n.º 2
0
  public static void registerRecipes() {
    HashMap<EnumTool, EnumAnvilRecipe> toolrecipes = new HashMap<EnumTool, EnumAnvilRecipe>();
    for (EnumAnvilRecipe recipe : values()) {
      if (recipe.tool == null) continue;
      toolrecipes.put(recipe.tool, recipe);
    }

    HashMap<Integer, EnumAnvilRecipe> armorrecipes = new HashMap<Integer, EnumAnvilRecipe>();
    for (EnumAnvilRecipe recipe : values()) {
      if (recipe.armorpiece == -1) continue;

      armorrecipes.put(recipe.armorpiece, recipe);
    }

    ItemStack output;
    for (EnumMetal metal : EnumMetal.values()) {
      ItemStack metalingot = ItemIngot.setMetal(new ItemStack(ItemsVC.metalingot), metal);
      ItemStack metalplate = BlocksVC.metalplate.getItemStackFor(metal);
      ItemStack twoDiamonds = ItemOreVC.getItemStackFor(EnumOreType.DIAMOND, 2);

      /** ** 1. Tool recipes *** */
      if (metal.hasTools) {
        for (EnumTool tool : EnumTool.values()) {
          if (tool.requiresWoodenHandle) {
            output =
                new ItemStack(
                    ItemsVC.toolheads.get(metal.getName() + "_" + tool.getName() + "toolhead"));
          } else {
            output = new ItemStack(ItemsVC.tools.get(metal.getName() + "_" + tool.getName()));
          }

          // System.out.println("output = " + output);
          metalingot.stackSize = toolrecipes.get(tool).ingots;

          WorkableRecipeBase recipe =
              toolrecipes.get(tool).registerRecipe(output.copy(), metalingot.copy());

          if (tool == EnumTool.CARPENTERSTOOLSET) {
            recipe.setIngredientText("4ingotstier2plus");
          }

          if (tool.isUpgradable) {
            if (tool.requiresWoodenHandle) {
              recipe =
                  toolrecipes
                      .get(tool)
                      .registerRecipe(
                          ItemToolHead.getDiamondEncrustedVariantOf(output),
                          metalingot.copy(),
                          twoDiamonds);
            } else {
              recipe =
                  toolrecipes
                      .get(tool)
                      .registerRecipe(
                          ItemToolVC.getDiamondEncrustedVarianOf(output),
                          metalingot.copy(),
                          twoDiamonds);
            }

            recipe.displayInRecipeHelper = false;
          }
        }
      }

      /** ** 2. Anvil recipes *** */
      if (metal.hasAnvil) {
        ItemStack anvil = ItemAnvilVC.withMetal(metal);
        ItemStack anvilbase = ItemAnvilPart.setMetal(new ItemStack(ItemsVC.anvilbase), metal);
        ItemStack anvilsurface = ItemAnvilPart.setMetal(new ItemStack(ItemsVC.anvilsurface), metal);

        metalingot.stackSize = EnumAnvilRecipe.ANVIL_BASE.ingots;
        EnumAnvilRecipe.ANVIL_BASE.registerRecipe(anvilbase, metalingot.copy());
        metalingot.stackSize = EnumAnvilRecipe.ANVIL_SURFACE.ingots;
        EnumAnvilRecipe.ANVIL_SURFACE.registerRecipe(anvilsurface, metalingot.copy());

        EnumAnvilRecipe.ANVIL
            .registerRecipe(anvil, anvilbase.copy(), anvilsurface.copy())
            .setIngredientText("anvilbaseplussurface");
      }

      /** ** 2. Fix ingot and plate recipes *** */
      metalingot.stackSize = 1;
      FIX_INGOT.registerRecipe(
          metalingot.copy(),
          ((ItemIngot) ItemsVC.metalingot).markOddlyShaped(metalingot.copy(), true));

      metalplate.stackSize = 1;
      FIX_PLATE.registerRecipe(
          metalplate.copy(),
          ((ItemMetalPlate) metalplate.getItem()).markOddlyShaped(metalplate.copy(), true));

      /** *** 3. Metal sheet, and armor **** */
      if (metal.hasArmor) {
        metalplate.stackSize = 1;
        metalingot.stackSize = 2;
        EnumAnvilRecipe.PLATE.registerRecipe(metalplate.copy(), metalingot.copy());

        for (int i = 0; i < ItemArmorVC.armorTypes.length; i++) {
          String armorpiece = ItemArmorVC.armorTypes[i];

          metalplate.stackSize = armorrecipes.get(i).plates;

          armorrecipes
              .get(i)
              .registerRecipe(
                  new ItemStack(ItemsVC.armor.get(metal.getName() + "_" + armorpiece)),
                  metalplate.copy());
        }
      }
    }

    // Coke Oven Door
    ItemStack ironplate = BlocksVC.metalplate.getItemStackFor(EnumMetal.IRON);
    ironplate.stackSize = 2;
    COKEOVENDOOR
        .registerRecipe(new ItemStack(BlocksVC.cokeovendoor), ironplate.copy())
        .setIngredientText("2ironplates");

    ironplate.stackSize = 3;
    WorkableRecipeBase recipe =
        MINECART.registerRecipe(new ItemStack(ItemsVC.emptyMinecart), ironplate.copy());
    recipe.setIngredientText("3ironplates");

    ironplate.stackSize = 3;
    recipe =
        COALPOWEREDMINECART.registerRecipe(
            new ItemStack(ItemsVC.coalpoweredMinecart),
            ironplate,
            new ItemStack(ItemsVC.emptyMinecart));
    recipe.setIngredientText("3ironplatesandemptyminecart");
  }