package chemicraft;
import java.util.ArrayList;
+import java.util.HashMap;
-import net.minecraft.src.CraftingManager;
import net.minecraft.src.ItemStack;
import chemicraft.system.ChemiCraftCraftingManager;
+import chemicraft.util.ChemicalNBTRecipe;
import chemicraft.util.ICompoundHandler;
import chemicraft.util.MaterialRecipe;
-import chemicraft.util.ChemicalNBTRecipe;
/**
* ChemiCraftのAPI
/**
* Instance of the ChemiCraftAPI.
*/
- public static ChemiCraftAPI instance = new ChemiCraftAPI();
+ public static final ChemiCraftAPI instance = new ChemiCraftAPI();
/**
* List of compounds names.
*/
- private ArrayList<String> compoundsNameList = new ArrayList();
+ private ArrayList<String> compoundsNameList = new ArrayList<String>();
/**
* List of compounds names(Some kind of language).
*/
- private ArrayList<String> compoundsLangNameList = new ArrayList();
+ private ArrayList<String> compoundsLangNameList = new ArrayList<String>();
/**
* List of compounds the language names.
*/
- private ArrayList<String> compoundsLangList = new ArrayList();
+ private ArrayList<String> compoundsLangList = new ArrayList<String>();
/**
/**
+ * 化合物の文字列をダメージ値に変換します。
+ */
+ private HashMap<String, Integer> compoundHash = new HashMap<String, Integer>();
+
+
+ /**
* List of item name of handler to compounds.
*/
private ArrayList<String> compoundHandlerItemNames = new ArrayList<String>();
+ public int getDamageByName(String englishName){
+ for(int i = 0;i < compoundsNameList.size();i++){
+ if(englishName.equals(compoundsNameList.get(i))){
+ compoundHash.put(englishName, i);
+ return i;
+ }
+ }
+ return -1;
+ }
+
+
+
+ public int getCompound(String key){
+ if(compoundHash.get(key) != null){
+ return compoundHash.get(key);
+ } else {
+ return -1;
+ }
+ }
+
+
+
/**
* setting compound handler.
* @param handlerItemName