OSDN Git Service

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