2016-02-19 21:32:26 +01:00
|
|
|
package techreborn.init;
|
|
|
|
|
|
|
|
import net.minecraft.init.Blocks;
|
|
|
|
import net.minecraft.init.Items;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import techreborn.api.recipe.IRecipeCompact;
|
2016-02-20 04:47:35 +01:00
|
|
|
import techreborn.blocks.BlockMachineFrame;
|
2016-04-30 06:21:28 +02:00
|
|
|
import techreborn.items.*;
|
2016-05-09 12:13:52 +02:00
|
|
|
import techreborn.parts.powerCables.ItemStandaloneCables;
|
2016-02-19 21:32:26 +01:00
|
|
|
|
2016-04-30 06:21:28 +02:00
|
|
|
import java.io.BufferedWriter;
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.FileWriter;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
public class RecipeCompact implements IRecipeCompact
|
|
|
|
{
|
2016-02-19 21:32:26 +01:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
HashMap<String, ItemStack> recipes = new HashMap<>();
|
2016-02-19 21:32:26 +01:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
ArrayList<String> missingItems = new ArrayList<>();
|
2016-02-20 20:46:18 +01:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
boolean inited = false;
|
2016-02-19 21:32:26 +01:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
public void init()
|
|
|
|
{
|
2016-05-06 23:13:24 +02:00
|
|
|
recipes.put("industrialDiamond", new ItemStack(Items.DIAMOND));
|
|
|
|
recipes.put("industrialTnt", new ItemStack(Blocks.TNT));
|
2016-03-25 10:47:34 +01:00
|
|
|
recipes.put("copperIngot", ItemIngots.getIngotByName("copper"));
|
|
|
|
recipes.put("tinIngot", ItemIngots.getIngotByName("tin"));
|
|
|
|
recipes.put("bronzeIngot", ItemIngots.getIngotByName("bronze"));
|
|
|
|
recipes.put("leadIngot", ItemIngots.getIngotByName("lead"));
|
|
|
|
recipes.put("silverIngot", ItemIngots.getIngotByName("silver"));
|
2016-04-30 06:21:28 +02:00
|
|
|
recipes.put("iridiumOre", ItemIngots.getIngotByName("iridium"));
|
2016-03-25 10:47:34 +01:00
|
|
|
recipes.put("plateiron", ItemPlates.getPlateByName("iron"));
|
|
|
|
recipes.put("iridiumPlate", ItemPlates.getPlateByName("iridium"));
|
|
|
|
recipes.put("cell", ItemCells.getCellByName("empty"));
|
|
|
|
recipes.put("airCell", ItemCells.getCellByName("empty"));
|
|
|
|
recipes.put("electronicCircuit", ItemParts.getPartByName("electronicCircuit"));
|
|
|
|
recipes.put("advancedCircuit", ItemParts.getPartByName("advancedCircuit"));
|
|
|
|
recipes.put("rubberWood", new ItemStack(ModBlocks.rubberLog));
|
|
|
|
recipes.put("resin", ItemParts.getPartByName("rubberSap"));
|
|
|
|
recipes.put("carbonPlate", ItemPlates.getPlateByName("carbon"));
|
|
|
|
recipes.put("reBattery", new ItemStack(ModItems.reBattery));
|
|
|
|
recipes.put("machine", BlockMachineFrame.getFrameByName("machine", 1));
|
|
|
|
recipes.put("advancedMachine", BlockMachineFrame.getFrameByName("advancedMachine", 1));
|
|
|
|
recipes.put("extractor", new ItemStack(ModBlocks.Extractor));
|
|
|
|
recipes.put("generator", new ItemStack(ModBlocks.Generator));
|
|
|
|
recipes.put("macerator", new ItemStack(ModBlocks.Grinder));
|
|
|
|
recipes.put("diamondDrill", new ItemStack(ModItems.diamondDrill));
|
|
|
|
recipes.put("miningDrill", new ItemStack(ModItems.ironDrill));
|
|
|
|
recipes.put("solarPanel", new ItemStack(ModBlocks.solarPanel));
|
|
|
|
recipes.put("waterCell", ItemCells.getCellByName("water"));
|
|
|
|
recipes.put("lavaCell", ItemCells.getCellByName("lava"));
|
2016-05-09 17:33:36 +02:00
|
|
|
recipes.put("pump", new ItemStack(ModBlocks.pump));
|
|
|
|
// recipes.put("teleporter", new ItemStack(ModItems.missingRecipe));
|
2016-04-30 06:21:28 +02:00
|
|
|
recipes.put("advancedAlloy", ItemIngots.getIngotByName("advancedAlloy"));
|
2016-03-25 10:47:34 +01:00
|
|
|
recipes.put("lvTransformer", new ItemStack(ModBlocks.lvt));
|
|
|
|
recipes.put("mvTransformer", new ItemStack(ModBlocks.mvt));
|
|
|
|
recipes.put("hvTransformer", new ItemStack(ModBlocks.hvt));
|
|
|
|
recipes.put("windMill", new ItemStack(ModBlocks.windMill));
|
|
|
|
recipes.put("energyCrystal", new ItemStack(ModItems.energyCrystal));
|
|
|
|
recipes.put("lapotronCrystal", new ItemStack(ModItems.lapotronCrystal));
|
|
|
|
recipes.put("reinforcedGlass", new ItemStack(ModBlocks.reinforcedglass));
|
|
|
|
recipes.put("compressor", new ItemStack(ModBlocks.Compressor));
|
|
|
|
recipes.put("insulatedGoldCableItem", ItemStandaloneCables.getCableByName("insulatedgold"));
|
2016-05-06 23:13:24 +02:00
|
|
|
recipes.put("fertilizer", new ItemStack(Items.DYE));
|
2016-03-25 10:47:34 +01:00
|
|
|
inited = false;
|
|
|
|
}
|
2016-02-20 20:46:18 +01:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
@Override
|
|
|
|
public ItemStack getItem(String name)
|
|
|
|
{
|
|
|
|
if (!inited)
|
|
|
|
{
|
|
|
|
init();
|
|
|
|
}
|
|
|
|
if (!recipes.containsKey(name))
|
|
|
|
{
|
|
|
|
if (!missingItems.contains(name))
|
|
|
|
{
|
|
|
|
missingItems.add(name);
|
|
|
|
}
|
|
|
|
return new ItemStack(ModItems.missingRecipe);
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
return recipes.get(name);
|
|
|
|
}
|
|
|
|
}
|
2016-02-19 21:32:26 +01:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
public void saveMissingItems(File mcDir) throws IOException
|
|
|
|
{
|
|
|
|
File missingItemsFile = new File(mcDir, "missingItems.txt");
|
|
|
|
if (missingItemsFile.exists())
|
|
|
|
{
|
|
|
|
missingItemsFile.delete();
|
|
|
|
}
|
|
|
|
BufferedWriter writer = new BufferedWriter(new FileWriter(missingItemsFile));
|
|
|
|
for (String str : missingItems)
|
|
|
|
{
|
|
|
|
writer.write(str);
|
|
|
|
writer.newLine();
|
|
|
|
}
|
|
|
|
writer.close();
|
|
|
|
}
|
2016-02-19 21:32:26 +01:00
|
|
|
|
|
|
|
}
|