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