OSDN Git Service

とりまコミット
[chemicraft/chemicraft.git] / common / chemicraft / ChemiCraftAPI.java
1 package chemicraft;
2
3 import java.util.ArrayList;
4
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;
11
12 /**
13  * ChemiCraftのAPI
14  * 基本的にAddonはこのクラスのインスタンスを使う
15  * @author mozipi
16  *
17  */
18 public class ChemiCraftAPI {
19
20         /**
21          * Instance of the ChemiCraftAPI.
22          */
23         public static ChemiCraftAPI instance = new ChemiCraftAPI();
24
25
26         /**
27          * List of compounds names.
28          */
29         private ArrayList<String> compoundsNameList = new ArrayList();
30
31
32         /**
33          * List of compounds names(Some kind of language).
34          */
35         private ArrayList<String> compoundsLangNameList = new ArrayList();
36
37
38         /**
39          * List of compounds the language names.
40          */
41         private ArrayList<String> compoundsLangList = new ArrayList();
42
43
44         /**
45          * List of compounds handlers.
46          */
47         private ArrayList<ICompoundHandler> compoundHandlers = new ArrayList<ICompoundHandler>();
48
49
50         /**
51          * List of item name of handler to compounds.
52          */
53         private ArrayList<String> compoundHandlerItemNames = new ArrayList<String>();
54
55
56         /**
57          * 分解台の素材のリスト
58          */
59         private ArrayList<ItemStack> decompositionMaterial = new ArrayList<ItemStack>();
60
61
62         /**
63          * 分解台の結果のリスト
64          */
65         private ArrayList<ItemStack[]> decompositionResults = new ArrayList<ItemStack[]>();
66
67
68         /**
69          * 化合台の素材のリスト
70          */
71         private ArrayList<ItemStack[]> chemicalCombinationMaterials = new ArrayList<ItemStack[]>();
72
73
74         /**
75          * 化合台の結果のリスト
76          */
77         private ArrayList<ItemStack> chemicalCombinationResult = new ArrayList<ItemStack>();
78
79
80         /**
81          * 素材製作台のレシピクラス
82          */
83         private ArrayList<MaterialRecipe> materialRecipe = new ArrayList<MaterialRecipe>();
84
85
86         /**
87          * ChemiCraftの化学作業台類のレシピのマネージャー
88          */
89         private ChemiCraftCraftingManager chemiCraftCraftingManager = new ChemiCraftCraftingManager();
90
91
92
93         /**
94          * add compound.
95          * @param name compound name.
96          */
97         public void addCompound(String name){
98                 compoundsNameList.add(name);
99                 compoundsLangNameList.add("");
100                 compoundsLangList.add("");
101         }
102
103
104
105         /**
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)
110          */
111         public void addLangCompound(String lang, String englishName, String langName){
112                 compoundsNameList.add(englishName);
113                 compoundsLangNameList.add(langName);
114                 compoundsLangList.add(lang);
115         }
116
117
118
119         /**
120          * setting compound handler.
121          * @param handlerItemName
122          * @param compoundHandler
123          */
124         public void settingCompoundHandler(String handlerItemName, ICompoundHandler compoundHandler){
125                 compoundHandlers.add(compoundHandler);
126                 compoundHandlerItemNames.add(handlerItemName);
127         }
128
129
130
131         /**
132          * 分解レシピを追加します。resultの要素数は0<= n <= 16にしてください。
133          * @param material 素材
134          * @param result 結果
135          */
136         public void addDecompositionRecipe(ItemStack material, ItemStack[] result){
137                 if(result.length <= 16){
138                         decompositionMaterial.add(material);
139                         decompositionResults.add(result);
140                 }else{
141                         System.err.println("ChemiCraft内でエラー:addDecompositionRecipeの引数resultの要素数が16を超えています。" + "Material:" + material + "  Result:" + result);
142                 }
143         }
144
145
146
147         /**
148          * 化合レシピを追加します。materialの要素数は0<= n <= 16にしてください。
149          * @param material 素材
150          * @param result 結果
151          */
152         public void addChemicalCombinationRecipe(ItemStack[] material, ItemStack result){
153                 if(material.length <= 16){
154                         chemicalCombinationMaterials.add(material);
155                         chemicalCombinationResult.add(result);
156                 }else{
157                         System.err.println("ChemiCraft内でエラー:addChemicalCombinationRecipeの引数materialの要素数が16を超えています。" + "Material:" + material + "  Result:" + result);
158                 }
159         }
160
161
162
163         public void addSharplessMaterialRecipe(ItemStack[] materials, ItemStack result, ChemicalNBTRecipe nbtRecipe){
164                 materialRecipe.add(new MaterialRecipe(result, materials, nbtRecipe, true));
165         }
166
167         public void addMaterialRecipe(ItemStack[] materials, ItemStack result, ChemicalNBTRecipe nbtRecipe){
168                 materialRecipe.add(new MaterialRecipe(result, materials, nbtRecipe, false));
169         }
170         //以下システム関連//////////////////////////////////////////////////////
171
172         public ArrayList<ICompoundHandler> getCompoundHandler(){
173                 compoundHandlers.trimToSize();
174                 return compoundHandlers;
175
176         }
177
178
179
180         public ArrayList<String> getCompoundHandlerItemName(){
181                 compoundHandlerItemNames.trimToSize();
182                 return compoundHandlerItemNames;
183         }
184
185
186
187         public ArrayList<String> getCompoundsName(){
188                 compoundsNameList.trimToSize();
189                 return compoundsNameList;
190         }
191
192
193
194         public ArrayList<String> getCompoundsLangName(){
195                 compoundsLangNameList.trimToSize();
196                 return compoundsLangNameList;
197         }
198
199
200
201         public ArrayList<String> getCompoundsLang(){
202                 compoundsLangList.trimToSize();
203                 return compoundsLangList;
204         }
205
206
207
208         public ArrayList<ItemStack> getDecompositionMaterial(){
209                 return decompositionMaterial;
210         }
211
212
213
214         public ArrayList<ItemStack[]> getDecompositionResult(){
215                 return decompositionResults;
216         }
217
218
219
220         public ArrayList<ItemStack[]> getChemicalCombinationMaterial(){
221                 return chemicalCombinationMaterials;
222         }
223
224
225
226         public ArrayList<ItemStack> getChemicalCombinationResult(){
227                 return chemicalCombinationResult;
228         }
229
230         public ArrayList<MaterialRecipe> getMaterialRecipe(){
231                 return materialRecipe;
232         }
233
234         public ChemiCraftCraftingManager getCraftingManager(){
235                 return chemiCraftCraftingManager;
236         }
237
238 }