3 import java.util.ArrayList;
5 import net.minecraft.src.CraftingManager;
6 import net.minecraft.src.ItemStack;
7 import chemicraft.system.ChemiCraftCraftingManager;
8 import chemicraft.util.ICompoundHandler;
9 import chemicraft.util.MaterialRecipe;
10 import chemicraft.util.ChemicalNBTRecipe;
14 * 基本的にAddonはこのクラスのインスタンスを使う
18 public class ChemiCraftAPI {
21 * Instance of the ChemiCraftAPI.
23 public static ChemiCraftAPI instance = new ChemiCraftAPI();
27 * List of compounds names.
29 private ArrayList<String> compoundsNameList = new ArrayList();
33 * List of compounds names(Some kind of language).
35 private ArrayList<String> compoundsLangNameList = new ArrayList();
39 * List of compounds the language names.
41 private ArrayList<String> compoundsLangList = new ArrayList();
45 * List of compounds handlers.
47 private ArrayList<ICompoundHandler> compoundHandlers = new ArrayList<ICompoundHandler>();
51 * List of item name of handler to compounds.
53 private ArrayList<String> compoundHandlerItemNames = new ArrayList<String>();
59 private ArrayList<ItemStack> decompositionMaterial = new ArrayList<ItemStack>();
65 private ArrayList<ItemStack[]> decompositionResults = new ArrayList<ItemStack[]>();
71 private ArrayList<ItemStack[]> chemicalCombinationMaterials = new ArrayList<ItemStack[]>();
77 private ArrayList<ItemStack> chemicalCombinationResult = new ArrayList<ItemStack>();
83 private ArrayList<MaterialRecipe> materialRecipe = new ArrayList<MaterialRecipe>();
87 * ChemiCraftの化学作業台類のレシピのマネージャー
89 private ChemiCraftCraftingManager chemiCraftCraftingManager = new ChemiCraftCraftingManager();
95 * @param name compound name.
97 public void addCompound(String name){
98 compoundsNameList.add(name);
99 compoundsLangNameList.add("");
100 compoundsLangList.add("");
106 * add compound corresponding to the language.
107 * @param lang Language to the corresponding
108 * @param englishName compound name
109 * @param langName compound name(specified language)
111 public void addLangCompound(String lang, String englishName, String langName){
112 compoundsNameList.add(englishName);
113 compoundsLangNameList.add(langName);
114 compoundsLangList.add(lang);
120 * setting compound handler.
121 * @param handlerItemName
122 * @param compoundHandler
124 public void settingCompoundHandler(String handlerItemName, ICompoundHandler compoundHandler){
125 compoundHandlers.add(compoundHandler);
126 compoundHandlerItemNames.add(handlerItemName);
132 * 分解レシピを追加します。resultの要素数は0<= n <= 16にしてください。
136 public void addDecompositionRecipe(ItemStack material, ItemStack[] result){
137 if(result.length <= 16){
138 decompositionMaterial.add(material);
139 decompositionResults.add(result);
141 System.err.println("ChemiCraft内でエラー:addDecompositionRecipeの引数resultの要素数が16を超えています。" + "Material:" + material + " Result:" + result);
148 * 化合レシピを追加します。materialの要素数は0<= n <= 16にしてください。
152 public void addChemicalCombinationRecipe(ItemStack[] material, ItemStack result){
153 if(material.length <= 16){
154 chemicalCombinationMaterials.add(material);
155 chemicalCombinationResult.add(result);
157 System.err.println("ChemiCraft内でエラー:addChemicalCombinationRecipeの引数materialの要素数が16を超えています。" + "Material:" + material + " Result:" + result);
163 public void addSharplessMaterialRecipe(ItemStack[] materials, ItemStack result, ChemicalNBTRecipe nbtRecipe){
164 materialRecipe.add(new MaterialRecipe(result, materials, nbtRecipe, true));
167 public void addMaterialRecipe(ItemStack[] materials, ItemStack result, ChemicalNBTRecipe nbtRecipe){
168 materialRecipe.add(new MaterialRecipe(result, materials, nbtRecipe, false));
170 //以下システム関連//////////////////////////////////////////////////////
172 public ArrayList<ICompoundHandler> getCompoundHandler(){
173 compoundHandlers.trimToSize();
174 return compoundHandlers;
180 public ArrayList<String> getCompoundHandlerItemName(){
181 compoundHandlerItemNames.trimToSize();
182 return compoundHandlerItemNames;
187 public ArrayList<String> getCompoundsName(){
188 compoundsNameList.trimToSize();
189 return compoundsNameList;
194 public ArrayList<String> getCompoundsLangName(){
195 compoundsLangNameList.trimToSize();
196 return compoundsLangNameList;
201 public ArrayList<String> getCompoundsLang(){
202 compoundsLangList.trimToSize();
203 return compoundsLangList;
208 public ArrayList<ItemStack> getDecompositionMaterial(){
209 return decompositionMaterial;
214 public ArrayList<ItemStack[]> getDecompositionResult(){
215 return decompositionResults;
220 public ArrayList<ItemStack[]> getChemicalCombinationMaterial(){
221 return chemicalCombinationMaterials;
226 public ArrayList<ItemStack> getChemicalCombinationResult(){
227 return chemicalCombinationResult;
230 public ArrayList<MaterialRecipe> getMaterialRecipe(){
231 return materialRecipe;
234 public ChemiCraftCraftingManager getCraftingManager(){
235 return chemiCraftCraftingManager;