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(
414                                 "LithiumOre",
415                                 new String[] { "Li", "Al", "Si", "O" },
416                                 new Integer[] { 1, 1, 4, 10 },
417                                 this.atomOresID[api.getAtomOresLastIndex()],
418                                 8,
419                                 EnumOreSpawnFrequency.NORMAL);
420                 // LiAlSi4O10
421                 api.addAtomOresLanguage("LithiumOre", "リチウム鉱石", "ja_JP");
422
423                 // ベリリウム
424                 api.addAtomOres(
425                                 "BerylliumOre",
426                                 new String[] { "Be", "Al", "Si", "O" },
427                                 new Integer[] { 3, 2, 6, 18 },
428                                 this.atomOresID[api.getAtomOresLastIndex()],
429                                 8,
430                                 EnumOreSpawnFrequency.NORMAL);
431                 // Be3Al2Si6O18
432                 api.addAtomOresLanguage("BerylliumOre", "ベリリウム鉱石", "ja_JP");
433
434                 // ホウ素
435                 api.addAtomOres(
436                                 "BoronOre",
437                                 new String[] { "Na", "Ca", "B", "O", "H" },
438                                 new Integer[] { 1, 1, 5, 17, 16 },
439                                 this.atomOresID[api.getAtomOresLastIndex()],
440                                 8,
441                                 EnumOreSpawnFrequency.NORMAL);
442                 // NaCaB5O6(OH)6・5H2O
443                 api.addAtomOresLanguage("BoronOre", "ホウ素鉱石", "ja_JP");
444
445                 // 炭素
446                 api.addPyrolysisDecompositionRecipe(
447                                 new ItemStack(Block.oreCoal),
448                                 new Integer[] { chemicalData.CARBON },
449                                 new Integer[] { 1 });
450
451                 // フッ素
452                 api.addAtomOres(
453                                 "FluorineOre",
454                                 new String[] { "Ca", "F" },
455                                 new Integer[] { 1, 2 },
456                                 this.atomOresID[api.getAtomOresLastIndex()],
457                                 8,
458                                 EnumOreSpawnFrequency.NORMAL);
459                 // CaF2
460                 api.addAtomOresLanguage("FluorineOre", "フッ素鉱石", "ja_JP");
461
462                 // ナトリウム
463                 api.addAtomOres(
464                                 "SodiumOre",
465                                 new String[] { "Na", "Cl" },
466                                 new Integer[] { 1, 1 },
467                                 this.atomOresID[api.getAtomOresLastIndex()],
468                                 8,
469                                 EnumOreSpawnFrequency.NORMAL);
470                 // NaCl
471                 api.addAtomOresLanguage("SodiumOre", "ナトリウム鉱石", "ja_JP");
472
473                 // マグネシウム
474                 api.addAtomOres(
475                                 "MagnesiumOre",
476                                 new String[] { "Ca", "Mg", "C", "O" },
477                                 new Integer[] { 1, 1, 2, 6 },
478                                 this.atomOresID[api.getAtomOresLastIndex()],
479                                 8,
480                                 EnumOreSpawnFrequency.NORMAL);
481                 // CaMg(CO3)2
482                 api.addAtomOresLanguage("MagnesiumOre", "マグネシウム鉱石", "ja_JP");
483
484                 // アルミニウム
485                 api.addAtomOres(
486                                 "AluminiumOre",
487                                 new String[] { "Al", "O", "H" },
488                                 new Integer[] { 3, 3, 3 },
489                                 this.atomOresID[api.getAtomOresLastIndex()],
490                                 8,
491                                 EnumOreSpawnFrequency.NORMAL);
492                 // Al(OH)3
493                 api.addAtomOresLanguage("AluminiumOre", "アルミニウム鉱石", "ja_JP");
494
495                 // ケイ素
496                 // 1.5まで保留。
497
498                 // リン
499                 api.addAtomOres(
500                                 "PhosphorusOre",
501                                 new String[] { "Ca", "P", "O", "F" },
502                                 new Integer[] { 5, 3, 12, 1 },
503                                 this.atomOresID[api.getAtomOresLastIndex()],
504                                 8,
505                                 EnumOreSpawnFrequency.NORMAL);
506                 // Ca5(PO4)3F
507                 api.addAtomOresLanguage("PhosphorusOre", "リン鉱石", "ja_JP");
508
509                 // 硫黄
510                 api.addAtomOres(
511                                 "SulfurOre",
512                                 new String[] { "S" },
513                                 new Integer[] { 1 },
514                                 this.atomOresID[api.getAtomOresLastIndex()],
515                                 8,
516                                 EnumOreSpawnFrequency.NORMAL);
517                 // S
518                 api.addAtomOresLanguage("SulfurOre", "硫黄鉱石", "ja_JP");
519
520                 // カリウム
521                 api.addAtomOres(
522                                 "PotassiumOre",
523                                 new String[] { "K", "Cl" },
524                                 new Integer[] { 1, 1 },
525                                 this.atomOresID[api.getAtomOresLastIndex()],
526                                 8,
527                                 EnumOreSpawnFrequency.NORMAL);
528                 // KCl
529                 api.addAtomOresLanguage("PotassiumOre", "カリウム鉱石", "ja_JP");
530
531                 // カルシウム
532                 api.addAtomOres(
533                                 "CalciumOre",
534                                 new String[] { "Ca", "C", "O" },
535                                 new Integer[] { 1, 1, 3 },
536                                 this.atomOresID[api.getAtomOresLastIndex()],
537                                 8,
538                                 EnumOreSpawnFrequency.NORMAL);
539                 // CaCO3
540                 api.addAtomOresLanguage("CalciumOre", "カルシウム鉱石", "ja_JP");
541
542                 // スカンジウム
543                 api.addAtomOres(
544                                 "ScandiumOre",
545                                 new String[] { "Sc", "Y", "Si", "O" },
546                                 new Integer[] { 2, 2, 2, 7 },
547                                 this.atomOresID[api.getAtomOresLastIndex()],
548                                 8,
549                                 EnumOreSpawnFrequency.NORMAL);
550                 // (Sc,Y)2Si2O7
551                 api.addAtomOresLanguage("ScandiumOre", "スカンジウム鉱石", "ja_JP");
552
553                 // チタン
554                 api.addAtomOres(
555                                 "TitaniumOre",
556                                 new String[] { "Ti", "O" },
557                                 new Integer[] { 1, 2 },
558                                 this.atomOresID[api.getAtomOresLastIndex()],
559                                 8,
560                                 EnumOreSpawnFrequency.NORMAL);
561                 // TiO2
562                 api.addAtomOresLanguage("TitaniumOre", "チタン鉱石", "ja_JP");
563
564                 // バナジウム
565                 api.addAtomOres(
566                                 "VanadiumOre",
567                                 new String[] { "K", "U", "O", "V", "H" },
568                                 new Integer[] { 2, 2, 15, 2, 6 },
569                                 this.atomOresID[api.getAtomOresLastIndex()],
570                                 8,
571                                 EnumOreSpawnFrequency.NORMAL);
572                 // K2(UO2)2V2O8・3H2O
573                 api.addAtomOresLanguage("VanadiumOre", "バナジウム鉱石", "ja_JP");
574
575                 // クロム
576                 api.addAtomOres(
577                                 "Chromium",
578                                 new String[] { "Fe", "Cr", "O" },
579                                 new Integer[] { 1, 2, 4 },
580                                 this.atomOresID[api.getAtomOresLastIndex()],
581                                 8,
582                                 EnumOreSpawnFrequency.NORMAL);
583                 api.addAtomOresLanguage("Chromium", "クロム鉱石", "ja_JP");
584                 // FeCr2O4
585
586                 // マンガン
587                 api.addAtomOres(
588                                 "ManganeseOre",
589                                 new String[] { "Mn", "O" },
590                                 new Integer[] { 1, 2 },
591                                 this.atomOresID[api.getAtomOresLastIndex()],
592                                 8,
593                                 EnumOreSpawnFrequency.NORMAL);
594                 api.addAtomOresLanguage("ManganeseOre", "ja_JP", "マンガン鉱石");
595                 // MnO2
596
597                 // コバルト
598                 api.addAtomOres(
599                                 "CobaltOre",
600                                 new String[] { "Co", "As", "S" },
601                                 new Integer[] { 1, 1, 1 },
602                                 this.atomOresID[api.getAtomOresLastIndex()],
603                                 8,
604                                 EnumOreSpawnFrequency.NORMAL);
605                 api.addAtomOresLanguage("CobaltOre", "ja_JP", "コバルト鉱石");
606                 // CoAsS
607
608                 // api.addAtomOres("元素名(英)", new String[]{"元素"}, new Integer[]{<数>}, this.atomOresID[api.getAtomOresLastIndex()], 8, EnumOreSpawnFrequency.NORMAL); // 化学式
609                 // api.addAtomOresLanguage("元素名(英)", "元素名(他国語)", "言語");
610
611                 //化合物を追加します
612                 this.api.addCompound("ja_JP", "ChlorousAcid", "亜塩素酸");
613                 this.api.addCompound("ja_JP", "CarbonMonoxide", "一酸化炭素");
614                 this.api.addCompound("ja_JP", "CarbonDioxide", "二酸化炭素");
615                 this.api.addCompound("ja_JP", "Water", "水");
616                 this.api.addCompound("ja_JP", "SodiumChloride", "塩化ナトリウム");
617                 this.api.addCompound("ja_JP", "SodiumBicarbonate", "重曹");
618
619                 //化合物のHandlerを設定します
620                 this.api.settingCompoundHandler("Water", new CompoundWater());
621
622                 //化合物のレシピを追加します
623                 this.api.addChemicalCombinationRecipe(new String[]{"Na", "O", "H"}, new Integer[]{1, 1, 1}, new ItemStack(this.itemCompounds, 1, this.api.getCompound("SodiumChloride")));
624                 this.api.addChemicalCombinationRecipe(new String[]{"H", "O", "Cl"}, new Integer[]{1, 2, 1}, new ItemStack(this.itemCompounds, 1, this.api.getCompound("ChlorousAcid")));
625                 this.api.addChemicalCombinationRecipe(new String[]{"H", "O"}, new Integer[]{2, 1}, new ItemStack(this.itemCompounds, 1, this.api.getCompound("Water")));
626
627                 //化学電池の追加
628                 this.api.addMaterialRecipe(new ItemStack[] {
629                                 null,
630                                 null,
631                                 null,
632                                 new ItemStack(this.itemAtoms, 1, chemicalData.ZINC),
633                                 null,
634                                 new ItemStack(this.itemAtoms, 1, chemicalData.COPPER),
635                                 new ItemStack(Item.bucketWater),
636                                 new ItemStack(Item.bucketWater),
637                                 new ItemStack(Item.bucketWater),
638                 },
639                 new ItemStack(this.itemChemicalCells, 1, 0),
640                 null);
641
642                 //手榴弾の追加
643                 this.api.addMaterialRecipe(new ItemStack[] {
644                                 null,
645                                 new ItemStack(Block.stone),
646                                 null,
647                                 new ItemStack(Block.stone),
648                                 new ItemStack(Item.gunpowder),
649                                 new ItemStack(Block.stone),
650                                 null,
651                                 new ItemStack(Block.stone),
652                                 null
653                 },
654                 new ItemStack(this.itemAtomGrenade, 16, 0),
655                 new NBTRecipeGrenade()
656                                 );
657
658                 this.api.addPyrolysisDecompositionRecipe(new ItemStack(Item.potion, 1, 0),
659                                 new Integer[] {ChemiCraftData.HYDROGEN, chemicalData.OXYGEN},
660                                 new Integer[] {2, 1});
661
662                 this.api.addPyrolysisDecompositionRecipe(new ItemStack(this.itemCompounds, 1, this.api.getCompound("Water")),
663                                 new Integer[] {ChemiCraftData.HYDROGEN, chemicalData.OXYGEN},
664                                 new Integer[] {2, 1});
665
666                 for (int i = 0; i < api.getAtomOresName().sizeKeysList(); i++){
667                         this.api.addPyrolysisDecompositionRecipe(new ItemStack(this.blockAtomOres[i / 16], 1, i - i / 16 * 16),
668                                         api.getAtomOresAtoms().get(api.getAtomOresName().getKeyList(i)),
669                                         api.getAtomOresAmounts().get(api.getAtomOresName().getKeyList(i)));
670                 }
671
672                 //Entityを追加
673                 LanguageRegistry.instance().addStringLocalization("entity.Dust.name", "en_US", "Dust");
674                 EntityRegistry.registerModEntity(EntityDust.class,
675                                 "Dust",
676                                 ModLoader.getUniqueEntityId(),
677                                 this,
678                                 250,
679                                 5,
680                                 true);
681
682                 this.api.addPyrolysisDecompositionFuel(new ItemStack(Item.coal), 2000*8);
683         }
684
685         private void apiProcessing(final FMLPostInitializationEvent event) {
686                 // API用の処理
687                 for (int i = 0; i < api.getAtomOresName().sizeKeysList(); i++)
688                 {
689                         for (int j = 0; j < api.getAtomOresName().sizeElementsList(api.getAtomOresName().getKeyList(i)); j++)
690                         {
691                                 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));
692                                 OreDictionary.registerOre("ore" + api.getAtomOresName().getKeyList(i), new ItemStack(blockAtomOres[i / 16], 1, i - i / 16 * 16));
693                         }
694                 }
695
696                 for (int i = 0; i < api.getAtomOres().size(); i++)
697                 {
698                         GameRegistry.registerWorldGenerator(api.getAtomOres().get(i));
699                 }
700
701                 for (int i = 0; i < api.getChemicalCellsName().sizeKeysList(); i++)
702                 {
703                         for (int j = 0; j < api.getChemicalCellsName().sizeElementsList(api.getChemicalCellsName().getKeyList(i)); j++)
704                         {
705                                 this.nameAuxiliary.addName(new ItemStack(itemChemicalCells, 0, i), api.getChemicalCellsLanguage().get(api.getChemicalCellsName().getKeyList(i), j), api.getChemicalCellsName().get(api.getChemicalCellsName().getKeyList(i), j));
706                         }
707                 }
708
709                 for (int i = 0; i < api.getCompoundsName().sizeKeysList(); i++)
710                 {
711                         for (int j = 0; j < api.getCompoundsName().sizeElementsList(api.getCompoundsName().getKeyList(i)); j++)
712                         {
713                                 this.nameAuxiliary.addName(new ItemStack(itemCompounds, 0, i), api.getCompoundsLang().get(api.getCompoundsName().getKeyList(i), j), api.getCompoundsName().get(api.getCompoundsName().getKeyList(i), j));
714                         }
715                 }
716
717         }
718
719         private void debug(final FMLPostInitializationEvent event) {
720                 this.proxy.registerTickHandler();
721                 this.api.addCompound("Debug");
722                 this.api.settingCompoundHandler("Debug", new CompoundDebug());
723
724                 this.api.addToolAndWeaponRecipe(new ItemStack[] {
725                                 new ItemStack(Block.stone, 1, 1)
726                 },
727                 new ItemStack(Block.dirt, 1, 0));
728
729         }
730
731 }