OSDN Git Service

316aec77d9f47fccc2e94f8920dde488b1cc6a55
[chemicraft/chemicraft.git] / common / pcc / chemicraft / ChemiCraft.java
1 package pcc.chemicraft;
2
3 import net.minecraft.block.Block;
4 import net.minecraft.block.material.Material;
5 import net.minecraft.creativetab.CreativeTabs;
6 import net.minecraft.item.Item;
7 import net.minecraft.item.ItemStack;
8 import net.minecraftforge.common.Configuration;
9 import net.minecraftforge.common.Property;
10 import net.minecraftforge.oredict.OreDictionary;
11 import pcc.chemicraft.block.BlockChemicalCombinationTable;
12 import pcc.chemicraft.block.BlockChemicalCraftingTable;
13 import pcc.chemicraft.block.BlockElectrolysisTable;
14 import pcc.chemicraft.block.BlockPyrolysisTable;
15 import pcc.chemicraft.block.BlockToolAndWeaponCraftingTable;
16 import pcc.chemicraft.compounds.CompoundDebug;
17 import pcc.chemicraft.compounds.CompoundWater;
18 import pcc.chemicraft.creativetab.CreativeTabAtomOres;
19 import pcc.chemicraft.creativetab.CreativeTabChemiCraft;
20 import pcc.chemicraft.debug.CommandDeleteItem;
21 import pcc.chemicraft.debug.CommandGenDebugRoom;
22 import pcc.chemicraft.debug.CommandSetTile;
23 import pcc.chemicraft.item.ItemAtoms;
24 import pcc.chemicraft.item.ItemAtomsGrenade;
25 import pcc.chemicraft.item.ItemChemiCell;
26 import pcc.chemicraft.item.ItemCompounds;
27 import pcc.chemicraft.item.ItemGasCollectingBottle;
28 import pcc.chemicraft.ore.BlockAtomOres;
29 import pcc.chemicraft.ore.ItemAtomOres;
30 import pcc.chemicraft.system.CommonProxy;
31 import pcc.chemicraft.system.PacketHandler;
32 import pcc.chemicraft.tileentity.TileEntityChemicalCombinationTable;
33 import pcc.chemicraft.tileentity.TileEntityChemicalCraftingTable;
34 import pcc.chemicraft.tileentity.TileEntityElectrolysisTable;
35 import pcc.chemicraft.tileentity.TileEntityPyrolysisTable;
36 import pcc.chemicraft.tileentity.TileEntityToolAndWeaponCraftingTable;
37 import pcc.chemicraft.util.Auxiliary;
38 import pcc.chemicraft.util.Auxiliary.ArrayAuxiliary;
39 import pcc.chemicraft.util.Auxiliary.NameAuxiliary;
40 import pcc.chemicraft.util.NBTRecipeGrenade;
41 import cpw.mods.fml.common.Mod;
42 import cpw.mods.fml.common.SidedProxy;
43 import cpw.mods.fml.common.event.FMLPostInitializationEvent;
44 import cpw.mods.fml.common.event.FMLPreInitializationEvent;
45 import cpw.mods.fml.common.event.FMLServerStartingEvent;
46 import cpw.mods.fml.common.network.NetworkMod;
47 import cpw.mods.fml.common.network.NetworkRegistry;
48 import cpw.mods.fml.common.registry.GameRegistry;
49 /**
50  * ChemiCraft本体
51  * @author P.C.C.
52  *
53  */
54 @Mod(modid = "chemiCraft", name = "ChemiCraft", version = "beta")
55 @NetworkMod(clientSideRequired = true, serverSideRequired = true, versionBounds = "1.4.6", channels = "chemicraft", packetHandler = PacketHandler.class)
56 public class ChemiCraft implements Runnable {
57
58         public static final String[] ATOMSNAME = {
59                 "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon",
60                 "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium",
61                 "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttorium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium",
62                 "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium",
63                 "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum",
64                 "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium",
65                 "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium",
66                 "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Ununtrium", "Ununquadium", "Ununpentium", "Ununhexium", "Ununseptium", "Ununoctium" };
67
68         public static final String[] ATOMSNAMEJP = {
69                 "水素", "ヘリウム", "リチウム", "ベリウム", "ホウ素", "炭素", "窒素", "酸素", "フッ素", "ネオン", "ナトリウム", "マグネシウム", "アルミニウム", "ケイ素", "リン", "硫黄", "塩素", "アルゴン", "カリウム", "カルシウム", "スカンジウム",
70                 "チタン", "バナジウム", "クロム", "マンガン", "鉄", "コバルト", "ニッケル", "銅", "亜鉛", "ガリウム", "ゲルマニウム", "ヒ素", "セレン", "臭素", "クリプトン", "ルビジウム", "ストロンチウム", "イットリウム", "ジルコニウム", "ニオブ", "モリブデン", "テクネチウム", "ルテニウム",
71                 "ロジウム", "パラジウム", "銀", "カドミウム", "インジウム", "スズ", "アンチモン", "テルル", "ヨウ素", "キセノン", "セシウム", "バリウム", "ランタン", "セリウム", "プラセオジム", "ネオジム", "プロメチウム", "サマリウム", "ユウロビウム", "ガドリニウム", "テルビウム", "ジスプロニウム",
72                 "ホルミウム", "エルビウム", "ツリウム", "イッテルビウム", "ルテチウム", "ハフニウム", "タンタル", "タングステン", "レニウム", "オスミウム", "イリジウム", "白金", "金", "水銀", "タリウム", "鉛", "ビスマス", "ポロニウム", "アスタチン", "ラドン", "フランシウム", "ラジウム",
73                 "アクチニウム", "トリウム", "プロトアクチウム", "ウラン", "ネプツニウム", "プルトニウム", "アメリシウム", "キュリウム", "バークリウム", "カルホルニウム", "アインスタイニウム", "フェルミウム", "メンデレビウム", "ノーベリウム", "ローレンシウム", "ラサホージウム", "ドブニウム", "シーボーギウム",
74                 "ボーリウム", "ハッシウム", "マイトネリウム", "ダームスタチウム", "レントゲニウム", "コペルニシウム", "ウンウントリウム", "ウンウンクアジウム", "ウンウンペンチウム", "ウンウンヘキシウム", "ウンウンセプチウム", "ウンウンオクチウム" };
75
76         /**
77          * このmodのインスタンス
78          */
79         @Mod.Instance("chemiCraft")
80         public static ChemiCraft instance;
81
82         /**
83          * ChemiCraftのProxy.
84          */
85         @SidedProxy(clientSide = "pcc.chemicraft.client.ClientProxy", serverSide = "pcc.chemicraft.system.CommonProxy")
86         public static CommonProxy proxy;
87
88         /**
89          * ChemiCraftのCreativeTab.
90          */
91         public static final CreativeTabs creativeTabChemiCraft = new CreativeTabChemiCraft("ChemiCraft");
92         public static final CreativeTabs creativeTabAtomsOre = new CreativeTabAtomOres("AtomsOre");
93
94         /**
95          * ItemID.
96          */
97         public int atomsID;
98         public int compoundsID;
99         public int gasCollectingBottleID;
100         public int atomGrenadeID;
101         public int chemicalCellsID;
102
103         /**
104          * BlockID.
105          */
106         public int pyrolysisTableID;
107         public int electrolysisTableID;
108         public int chemicalConbinationTableID;
109         public int toolAndWeaponCraftingTableID;
110         public int chemicalCraftingTableID;
111
112         public int[] atomOresID = new int[3];
113
114         /**
115          * GUIID.
116          */
117         public int guiPyrolysisTableID;
118         public int guiElectrolysisTableID;
119         public int guiChemicalCombinationTableID;
120         public int guiToolAndWeaponCraftingTableID;
121         public int guiChemicalCraftingTableID;
122
123         /**
124          * Block型変数.
125          */
126         public Block blockPyrolysisTable;
127         public Block blockElectrolysisTable;
128         public Block blockChemicalCombinationTable;
129         public Block blockToolAndWeaponCraftingTable;
130         public Block blockChemicalCraftingTable;
131
132         public Block[] blockAtomOres = new Block[atomOresID.length];
133
134         /**
135          * Item型変数.
136          */
137         public Item itemAtoms;
138         public Item itemCompounds;
139         public Item itemGasCollectingBottle;
140         public Item itemAtomGrenade;
141         public Item itemChemicalCells;
142
143         /**
144          * このmodで使用するTextureのパス.
145          */
146         public final String ITEM_ATOMS_TEXTURE = "/pcc/chemicraft/items/Atoms.png";
147         public final String ITEM_COMPOUNDS_TEXTURE = "/pcc/chemicraft/items/Compounds.png";
148         public final String ITEM_VEGETABLES_TEXTURE = "/pcc/chemicraft/items/Vegetables.png";
149         public final String ITEM_TEXTURE = "/pcc/chemicraft/items/items.png";
150         public final String BLOCK_CHEMICAL_CRAFTING_TABLE_TEXTURE = "/pcc/chemicraft/blocks/cctable.png";
151         public final String BLOCK_ATOMS_ORE_TEXTURE = "/pcc/chemicraft/blocks/AtomsOre.png";
152         public final String BLOCK_VEGETABLES_TEXTURE = "/pcc/chemicraft/blocks/Vegetables.png";
153         public final String GUI_PYROLYSIS_TEXTURE = "/pcc/chemicraft/guis/Pyrolysis.png";
154         public final String GUI_ELECTROLYSIS_TEXTURE = "/pcc/chemicraft/guis/Electrolysis.png";
155         public final String GUI_CHEMICALCOMBINATION_TEXTURE = "/pcc/chemicraft/guis/ChemicalCombination.png";
156         public final String GUI_TOOLANDWEAPONCRAFTING_TEXTURE = "/pcc/chemicraft/guis/ToolAndWeaponCrafting.png";
157         public final String GUI_CHEMICALCRAFTING_TEXTURE = "/pcc/chemicraft/guis/MaterialCrafting.png";
158
159         /**
160          * このmodに必要な補助クラスのインスタンス.
161          */
162         public Auxiliary auxiliary = new Auxiliary();
163         public NameAuxiliary nameAuxiliary = new NameAuxiliary();
164         public ArrayAuxiliary arrayAuxiliary = new ArrayAuxiliary();
165
166         private ChemiCraftAPI api = ChemiCraftAPI.instance();
167         private ChemiCraftData chemicalData = new ChemiCraftData();
168
169         /**
170          * このMODのスレッド
171          */
172         private Thread thread;
173
174         /**
175          * Eventのインスタンス(PostInit以降)
176          */
177         private FMLPostInitializationEvent event;
178
179         @Mod.PreInit
180         public void chemiPreLoadMethod(final FMLPreInitializationEvent event) {
181                 Configuration cfg = new Configuration(event.getSuggestedConfigurationFile());
182                 cfg.load();
183
184                 Property pyrolysisTableIDProp = cfg.getBlock("PyrolysisTable", 2400);
185                 Property electrolysisTableIDProp = cfg.getBlock("ElectrolysisTable", 2401);
186                 Property chemicalCombinationTableIDProp = cfg.getBlock("ChemicalCombinationID", 2402);
187                 Property toolAndWeaponCraftingTableIDProp = cfg.getBlock("ToolAndWeaponCraftingTableID", 2403);
188                 Property chemicalCraftingTableIDProp = cfg.getBlock("ChemicalCraftingTableID", 2404);
189
190                 Property[] atomOresIDProp = new Property[this.atomOresID.length];
191                 for (int i = 0; i < atomOresIDProp.length; i++) {
192                         atomOresIDProp[i] = cfg.getBlock("AtomsOreID:" + i, 2500 + i);
193                 }
194
195                 Property atomsIDProp = cfg.getItem("AtomsID", 25000);
196                 Property compoundsIDProp = cfg.getItem("CompoundsID", 25001);
197                 Property gasCollectingBottleIDProp = cfg.getItem("gasCollectingBottleID", 25002);
198                 Property atomGrenadeIDProp = cfg.getItem("AtomGrenadeID", 25003);
199                 Property chemicalCellsIDProp = cfg.getItem("ChemicalCellID", 25004);
200
201                 Property guiPyrolysisTableIDProp = cfg.get("GUI", "GUIPyrolysisID", 1000);
202                 Property guiElectrolysisTableIDProp = cfg.get("GUI", "GUIElectrolysisTableIDProp", 1001);
203                 Property guiChemicalCombinationTableIDProp = cfg.get("GUI", "GUIChemicalCombinationTableID", 1002);
204                 Property guiToolAndWeaponCraftingTableIDProp = cfg.get("GUI", "GUIToolAndWeaponCraftingTableID", 1003);
205                 Property guiChemicalCraftingTableIDProp = cfg.get("GUI", "GUIChemicalCraftingTableID", 1004);
206
207
208                 this.pyrolysisTableID = pyrolysisTableIDProp.getInt();
209                 this.electrolysisTableID = electrolysisTableIDProp.getInt();
210                 this.chemicalConbinationTableID = chemicalCombinationTableIDProp.getInt();
211                 this.toolAndWeaponCraftingTableID = toolAndWeaponCraftingTableIDProp.getInt();
212                 this.chemicalCraftingTableID = chemicalCraftingTableIDProp.getInt();
213                 for (int i = 0; i < atomOresID.length; i++) {
214                         this.atomOresID[i] = atomOresIDProp[i].getInt();
215                 }
216
217                 this.atomsID = atomsIDProp.getInt();
218                 this.compoundsID = compoundsIDProp.getInt();
219                 this.gasCollectingBottleID = gasCollectingBottleIDProp.getInt();
220                 this.atomGrenadeID = atomGrenadeIDProp.getInt();
221                 this.chemicalCellsID = chemicalCellsIDProp.getInt();
222
223                 this.guiPyrolysisTableID = guiPyrolysisTableIDProp.getInt();
224                 this.guiElectrolysisTableID = guiElectrolysisTableIDProp.getInt();
225                 this.guiChemicalCombinationTableID = guiChemicalCombinationTableIDProp.getInt();
226                 this.guiToolAndWeaponCraftingTableID = guiToolAndWeaponCraftingTableIDProp.getInt();
227                 this.guiChemicalCraftingTableID = guiChemicalCraftingTableIDProp.getInt();
228
229                 cfg.save();
230         }
231
232         @Mod.ServerStarting
233         public void serverStarting(final FMLServerStartingEvent event) {
234                 event.registerServerCommand(new CommandSetTile());
235                 event.registerServerCommand(new CommandDeleteItem());
236                 event.registerServerCommand(new CommandGenDebugRoom());
237         }
238
239         @Mod.PostInit
240         public void chemiPostLoadMethod(final FMLPostInitializationEvent event) {
241                 this.thread = new Thread(this);
242                 this.event = event;
243                 this.thread.start();
244                 try {
245                         this.thread.join();
246                 } catch (InterruptedException e) {
247                         e.printStackTrace();
248                 }
249                 proxy.registerRenderInformation();
250                 Thread.yield();
251         }
252
253         @Override
254         public void run() {
255                 while (true) {
256                         if (proxy != null && instance != null) {
257                                 this.settingProcessing(event);
258                                 this.apiProcessing(event);
259                                 this.debug(event);
260                                 break;
261                         }
262                 }
263         }
264
265         private void settingProcessing(final FMLPostInitializationEvent event) {
266
267                 // Blockを追加します
268                 this.blockPyrolysisTable = new BlockPyrolysisTable(this.pyrolysisTableID, 0, Material.ground).
269                                 setHardness(2.0F).
270                                 setResistance(0.0F).
271                                 setStepSound(Block.soundStoneFootstep).
272                                 setBlockName("PyrolysisTable");
273                 this.blockElectrolysisTable = new BlockElectrolysisTable(this.electrolysisTableID, 1, Material.ground).
274                                 setHardness(2.0F).
275                                 setResistance(0.0F).
276                                 setStepSound(Block.soundStoneFootstep).
277                                 setBlockName("ElectrolysisTable");
278                 this.blockChemicalCombinationTable = new BlockChemicalCombinationTable(this.chemicalConbinationTableID, 2, Material.ground).
279                                 setHardness(2.0F).
280                                 setResistance(0.0F).
281                                 setStepSound(Block.soundStoneFootstep).
282                                 setBlockName("ChemicalCombinationTable");
283                 this.blockToolAndWeaponCraftingTable = new BlockToolAndWeaponCraftingTable(this.toolAndWeaponCraftingTableID, 3, Material.ground).
284                                 setHardness(2.0F).
285                                 setResistance(0.0F).
286                                 setStepSound(Block.soundStoneFootstep).
287                                 setBlockName("ToolAndWeaponCraftingTable");
288                 this.blockChemicalCraftingTable = new BlockChemicalCraftingTable(this.chemicalCraftingTableID, 4, Material.ground).
289                                 setHardness(2.0F).
290                                 setResistance(0.0F).
291                                 setStepSound(Block.soundStoneFootstep).
292                                 setBlockName("ChemicalCraftingTable");
293
294                 for (int i = 0; i < blockAtomOres.length; i++)
295                 {
296                         this.blockAtomOres[i] = new BlockAtomOres(this.atomOresID[i]).
297                                         setHardness(3.0F).
298                                         setResistance(0.0F).
299                                         setStepSound(Block.soundStoneFootstep).
300                                         setBlockName("AtomsOre" + i);
301                         GameRegistry.registerBlock(blockAtomOres[i], ItemAtomOres.class, "AtomsOre" + i);
302                 }
303
304                 // Itemを追加します
305                 this.itemAtoms = new ItemAtoms(this.atomsID).setItemName("atoms");
306                 this.itemCompounds = new ItemCompounds(this.compoundsID).setItemName("compounds");
307                 this.itemGasCollectingBottle = new ItemGasCollectingBottle(this.gasCollectingBottleID).setItemName("gasCollectingBottle").setIconIndex(0);
308                 this.itemAtomGrenade = new ItemAtomsGrenade(this.atomGrenadeID).setItemName("grenade").setIconIndex(1);
309                 this.itemChemicalCells = new ItemChemiCell(this.chemicalCellsID).setItemName("chemiCell").setIconIndex(3);
310
311                 // BlockをMinecraftに登録します
312                 GameRegistry.registerBlock(this.blockPyrolysisTable, "BlockPyrolysisTable");
313                 GameRegistry.registerBlock(this.blockChemicalCombinationTable, "BlockChemicalCombinationTable");
314                 GameRegistry.registerBlock(this.blockToolAndWeaponCraftingTable, "BlockToolAndWeaponCraftingTable");
315                 GameRegistry.registerBlock(this.blockChemicalCraftingTable, "BlockMaterialCraftingTable");
316                 GameRegistry.registerBlock(this.blockElectrolysisTable, "BlockElectrolysisTable");
317
318                 // Blockの名前を設定します
319                 this.nameAuxiliary.addName(this.blockPyrolysisTable, "PyrolysisTable");
320                 this.nameAuxiliary.addName(this.blockPyrolysisTable, "ja_JP", "熱分解台");
321                 this.nameAuxiliary.addName(this.blockChemicalCombinationTable, "ChemicalCombinationTable");
322                 this.nameAuxiliary.addName(this.blockChemicalCombinationTable, "ja_JP", "化合台");
323                 this.nameAuxiliary.addName(this.blockToolAndWeaponCraftingTable, "ToolAndWeaponCraftingTable");
324                 this.nameAuxiliary.addName(this.blockToolAndWeaponCraftingTable, "ja_JP", "ツール&武器製作台");
325                 this.nameAuxiliary.addName(this.blockChemicalCraftingTable, "ChemicalCraftingTable");
326                 this.nameAuxiliary.addName(this.blockChemicalCraftingTable, "ja_JP", "素材製作台");
327                 this.nameAuxiliary.addName(this.blockElectrolysisTable, "ElectrolysisTable");
328                 this.nameAuxiliary.addName(this.blockElectrolysisTable, "ja_JP", "電気分解台");
329
330                 // Itemの名前を設定します
331                 this.nameAuxiliary.addName(this.itemAtoms, ATOMSNAME);
332                 this.nameAuxiliary.addName(this.itemAtoms, "ja_JP", ATOMSNAMEJP);
333                 this.nameAuxiliary.addName(this.itemGasCollectingBottle, "GasCollectingBottle");
334                 this.nameAuxiliary.addName(this.itemGasCollectingBottle, "ja_JP", "集気瓶");
335                 this.nameAuxiliary.addName(this.itemAtomGrenade, "AtomGrenade");
336                 this.nameAuxiliary.addName(this.itemAtomGrenade, "ja_JP", "元素手榴弾");
337
338                 // TileEntityを追加します
339                 GameRegistry.registerTileEntity(TileEntityPyrolysisTable.class, "TileEntityPyrolysisTable");
340                 GameRegistry.registerTileEntity(TileEntityChemicalCombinationTable.class, "TileEntityChemicalCombinationTable");
341                 GameRegistry.registerTileEntity(TileEntityToolAndWeaponCraftingTable.class, "TileEntityToolAndWeaponCraftingTable");
342                 GameRegistry.registerTileEntity(TileEntityChemicalCraftingTable.class, "TileEntityChemicalCraftingTable");
343                 GameRegistry.registerTileEntity(TileEntityElectrolysisTable.class, "TileEntityElectrolysisTable");
344
345                 // GUIを追加します
346                 NetworkRegistry.instance().registerGuiHandler(instance, proxy);
347
348                 //化学作業台類のレシピを追加します
349                 GameRegistry.addRecipe(new ItemStack(this.blockPyrolysisTable),
350                                 new Object[]{
351                         "XYX", "ZAZ", "ZZZ",
352                         Character.valueOf('X'), new ItemStack(Item.ingotIron),
353                         Character.valueOf('Y'), new ItemStack(Block.workbench),
354                         Character.valueOf('Z'), new ItemStack(Block.stone),
355                         Character.valueOf('A'), new ItemStack(Item.bucketLava),
356                 });
357                 GameRegistry.addRecipe(new ItemStack(this.blockChemicalCombinationTable),
358                                 new Object[]{
359                         "XYX", "ZAZ", "ZZZ",
360                         Character.valueOf('X'), new ItemStack(Item.ingotIron),
361                         Character.valueOf('Y'), new ItemStack(Block.workbench),
362                         Character.valueOf('Z'), new ItemStack(Block.stone),
363                         Character.valueOf('A'), new ItemStack(Block.obsidian),
364                 });
365                 GameRegistry.addRecipe(new ItemStack(this.blockToolAndWeaponCraftingTable),
366                                 new Object[]{
367                         "XYX", "ZAZ", "ZZZ",
368                         Character.valueOf('X'), new ItemStack(Item.ingotIron),
369                         Character.valueOf('Y'), new ItemStack(Block.workbench),
370                         Character.valueOf('Z'), new ItemStack(Block.stone),
371                         Character.valueOf('A'), new ItemStack(Item.pickaxeSteel),
372                 });
373                 GameRegistry.addRecipe(new ItemStack(this.blockChemicalCraftingTable),
374                                 new Object[]{
375                         "XYX", "ZAZ", "ZZZ",
376                         Character.valueOf('X'), new ItemStack(Item.ingotIron),
377                         Character.valueOf('Y'), new ItemStack(Block.workbench),
378                         Character.valueOf('Z'), new ItemStack(Block.stone),
379                         Character.valueOf('A'), new ItemStack(this.itemAtoms, 1, 0),
380                 });
381
382                 //電池を追加します
383                 api.addChemicalCell(itemChemicalCells, "ChemicalCell", 1000);
384                 api.addChemicalCellLanguage("ChemicalCell", "ja_JP", "化学電池");
385
386                 //鉱石を追加します
387
388                 // リチウム
389                 api.addAtomOres("Petalite", new String[]{"Li", "Al", "Si", "O"}, new Integer[]{1, 1, 4, 10}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // LiAlSi4O10
390                 api.addAtomOresLanguage("Petalite", "ペタル石", "ja_JP");
391                 api.addAtomOres("Spodumene", new String[]{"Li", "Al", "Si", "O"}, new Integer[]{1, 1, 2, 6}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // LiAlSi2O6
392                 api.addAtomOresLanguage("Spodumene", "リチア輝石", "ja_JP");
393
394                 // ベリリウム
395                 api.addAtomOres("Beryl", new String[]{"Be", "Al", "Si", "O"}, new Integer[]{3, 2, 6, 18}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // Be3Al2Si6O18
396                 api.addAtomOresLanguage("Beryl", "緑柱石", "ja_JP");
397                 api.addAtomOres("Chrysoberyl", new String[]{"Be", "Al", "O"}, new Integer[]{1, 2, 4}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // BeAl2O4
398                 api.addAtomOresLanguage("Chrysoberyl", "金緑石", "ja_JP");
399
400                 // ホウ素
401                 api.addAtomOres("Ulexite", new String[]{"Na", "Ca", "B", "O"}, new Integer[]{1, 1, 5, 6}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50);   // NaCaB5O6(OH)6・5H2O
402                 api.addAtomOresLanguage("Ulexite", "ウレキサイト", "ja_JP");
403
404                 // フッ素
405                 api.addAtomOres("Fluorite", new String[]{"Ca", "F"}, new Integer[]{1, 2}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // CaF2
406                 api.addAtomOresLanguage("Fluorite", "蛍石", "ja_JP");
407                 api.addAtomOres("Cryolite", new String[]{"Na", "Al", "F"}, new Integer[]{3, 1, 6}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // Na3AlF6
408                 api.addAtomOresLanguage("Cryolite", "氷晶石", "ja_JP");
409
410                 // ナトリウム
411                 api.addAtomOres("RockSalt", new String[]{"Na", "Cl"}, new Integer[]{1, 1}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // NaCl
412                 api.addAtomOresLanguage("RockSalt", "岩塩", "ja_JP");
413
414                 // マグネシウム
415                 api.addAtomOres("Dolomite", new String[]{"Ca", "Mg"}, new Integer[]{1, 1}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // CaMg(CO3)2
416                 api.addAtomOresLanguage("Dolomite", "苦灰石", "ja_JP");
417                 api.addAtomOres("Magnesite", new String[]{"Mg", "C", "O"}, new Integer[]{1, 1, 3}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // MgCO3
418                 api.addAtomOresLanguage("Magnesite", "菱苦土石", "ja_JP");
419
420                 // アルミニウム
421                 api.addAtomOres("Gibbsite", new String[]{"Al"}, new Integer[]{3}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // Al(OH)3
422                 api.addAtomOresLanguage("Gibbsite", "ギブス石", "ja_JP");
423                 api.addAtomOres("Ruby", new String[]{"Al", "O"}, new Integer[]{2, 3}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // Al2O3
424                 api.addAtomOresLanguage("Ruby", "ルビー", "ja_JP");
425                 api.addAtomOres("Sapphire", new String[]{"Al", "O"}, new Integer[]{2, 3}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // Al2O3
426                 api.addAtomOresLanguage("Sapphire", "サファイア", "ja_JP");
427
428                 // ケイ素
429                 api.addAtomOres("Quartz", new String[]{"Si", "O"}, new Integer[]{1, 2}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // SiO2
430                 api.addAtomOresLanguage("Quartz", "石英", "ja_JP");
431
432                 // リン
433                 api.addAtomOres("Fluorapatite", new String[]{"Ca"}, new Integer[]{5}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // Ca5(PO4)3F
434                 api.addAtomOresLanguage("Fluorapatite", "フッ素リン灰石", "ja_JP");
435                 api.addAtomOres("Chlorapatite", new String[]{"Ca"}, new Integer[]{5}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // Ca5(PO4)3Cl
436                 api.addAtomOresLanguage("Chlorapatite", "塩素燐灰石", "ja_JP");
437                 api.addAtomOres("Hydroxylapatite", new String[]{"Ca"}, new Integer[]{5}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // Ca5(PO4)3(OH)
438                 api.addAtomOresLanguage("Hydroxylapatite", "水酸燐灰石", "ja_JP");
439
440                 // カリウム
441                 api.addAtomOres("Sylvite", new String[]{"K", "Cl"}, new Integer[]{1, 1}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // KCl
442                 api.addAtomOresLanguage("Sylvite", "カリ岩塩", "ja_JP");
443
444                 // カルシウム
445                 api.addAtomOres("Calcite", new String[]{"Ca", "C", "O"}, new Integer[]{1, 1, 3}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // CaCO3
446                 api.addAtomOresLanguage("Calcite", "方解石", "ja_JP");
447
448                 // api.addAtomOres("元素名(英)", new String[]{"元素"}, new Integer[]{<数>}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // 化学式
449                 // api.addAtomOresLanguage("元素名(英)", "元素名(他国語)", "言語");
450
451                 //化合物を追加します
452                 this.api.addCompound("ja_JP", "ChlorousAcid", "亜塩素酸");
453                 this.api.addCompound("ja_JP", "CarbonMonoxide", "一酸化炭素");
454                 this.api.addCompound("ja_JP", "CarbonDioxide", "二酸化炭素");
455                 this.api.addCompound("ja_JP", "Water", "水");
456                 this.api.addCompound("ja_JP", "SodiumChloride", "塩化ナトリウム");
457                 this.api.addCompound("ja_JP", "SodiumBicarbonate", "重曹");
458
459                 //化合物のHandlerを設定します
460                 this.api.settingCompoundHandler("Water", new CompoundWater());
461
462                 //化合物のレシピを追加します
463                 this.api.addChemicalCombinationRecipe(new String[]{"Na", "O", "H"}, new Integer[]{1, 1, 1}, new ItemStack(this.itemCompounds, 1, this.api.getCompound("SodiumChloride")));
464                 this.api.addChemicalCombinationRecipe(new String[]{"H", "O", "Cl"}, new Integer[]{1, 2, 1}, new ItemStack(this.itemCompounds, 1, this.api.getCompound("ChlorousAcid")));
465                 this.api.addChemicalCombinationRecipe(new String[]{"H", "O"}, new Integer[]{2, 1}, new ItemStack(this.itemCompounds, 1, this.api.getCompound("Water")));
466
467                 //化学電池の追加
468                 this.api.addMaterialRecipe(new ItemStack[] {
469                                 null,
470                                 null,
471                                 null,
472                                 new ItemStack(this.itemAtoms, 1, ChemiCraftData.ZINC),
473                                 null,
474                                 new ItemStack(this.itemAtoms, 1, ChemiCraftData.COPPER),
475                                 new ItemStack(Item.bucketWater),
476                                 new ItemStack(Item.bucketWater),
477                                 new ItemStack(Item.bucketWater),
478                 },
479                 new ItemStack(this.itemChemicalCells, 1, 0),
480                 null);
481
482                 //手榴弾の追加
483                 this.api.addMaterialRecipe(new ItemStack[] {
484                                 null,
485                                 new ItemStack(Block.stone),
486                                 null,
487                                 new ItemStack(Block.stone),
488                                 new ItemStack(Item.gunpowder),
489                                 new ItemStack(Block.stone),
490                                 null,
491                                 new ItemStack(Block.stone),
492                                 null
493                 },
494                 new ItemStack(this.itemAtomGrenade, 16, 0),
495                 new NBTRecipeGrenade()
496                                 );
497
498                 this.api.addPyrolysisDecompositionRecipe(new ItemStack(Item.potion, 1, 0),
499                                 new Integer[] {ChemiCraftData.HYDROGEN, ChemiCraftData.OXYGEN},
500                                 new Integer[] {2, 1});
501
502                 this.api.addPyrolysisDecompositionRecipe(new ItemStack(this.itemCompounds, 1, this.api.getCompound("Water")),
503                                 new Integer[] {ChemiCraftData.HYDROGEN, ChemiCraftData.OXYGEN},
504                                 new Integer[] {2, 1});
505
506                 for (int i = 0; i < api.getAtomOresName().sizeKeysList(); i++){
507                         this.api.addPyrolysisDecompositionRecipe(new ItemStack(this.blockAtomOres[i / 16], 1, i - i / 16 * 16),
508                                         api.getAtomOresAtoms().get(api.getAtomOresName().getKeyList(i)),
509                                         api.getAtomOresAmounts().get(api.getAtomOresName().getKeyList(i)));
510                 }
511
512                 this.api.addPyrolysisDecompositionFuel(new ItemStack(Item.coal), 2000*8);
513         }
514
515         private void apiProcessing(final FMLPostInitializationEvent event) {
516                 // API用の処理
517                 for (int i = 0; i < api.getAtomOresName().sizeKeysList(); i++)
518                 {
519                         for (int j = 0; j < api.getAtomOresName().sizeElementsList(api.getAtomOresName().getKeyList(i)); j++)
520                         {
521                                 this.nameAuxiliary.addName(new ItemStack(blockAtomOres[i / 16], 0, i - i / 16 * 16), api.getAtomOresLanguage().get(api.getAtomOresName().getKeyList(i), j), api.getAtomOresName().get(api.getAtomOresName().getKeyList(i), j));
522                                 OreDictionary.registerOre("ore" + api.getAtomOresName().getKeyList(i), new ItemStack(blockAtomOres[i / 16], 1, i - i / 16 * 16));
523                         }
524                 }
525
526                 for (int i = 0; i < api.getAtomOres().size(); i++)
527                 {
528                         GameRegistry.registerWorldGenerator(api.getAtomOres().get(i));
529                 }
530
531                 for (int i = 0; i < api.getChemicalCellsName().sizeKeysList(); i++)
532                 {
533                         for (int j = 0; j < api.getChemicalCellsName().sizeElementsList(api.getChemicalCellsName().getKeyList(i)); j++)
534                         {
535                                 this.nameAuxiliary.addName(new ItemStack(itemChemicalCells, 0, i), api.getChemicalCellsLanguage().get(api.getChemicalCellsName().getKeyList(i), j), api.getChemicalCellsName().get(api.getChemicalCellsName().getKeyList(i), j));
536                         }
537                 }
538
539                 for (int i = 0; i < api.getCompoundsName().sizeKeysList(); i++)
540                 {
541                         for (int j = 0; j < api.getCompoundsName().sizeElementsList(api.getCompoundsName().getKeyList(i)); j++)
542                         {
543                                 this.nameAuxiliary.addName(new ItemStack(itemCompounds, 0, i), api.getCompoundsLang().get(api.getCompoundsName().getKeyList(i), j), api.getCompoundsName().get(api.getCompoundsName().getKeyList(i), j));
544                         }
545                 }
546
547         }
548
549         private void debug(final FMLPostInitializationEvent event) {
550                 this.proxy.registerTickHandler();
551                 this.api.addCompound("Debug");
552                 this.api.settingCompoundHandler("Debug", new CompoundDebug());
553
554                 this.api.addToolAndWeaponRecipe(new ItemStack[] {
555                                 new ItemStack(Block.stone, 1, 1)
556                 },
557                 new ItemStack(Block.dirt, 1, 0));
558
559         }
560
561 }