OSDN Git Service

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