OSDN Git Service

Merge branch 'master' of https://scm.sourceforge.jp/gitroot/chemicraft/chemicraft
[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                 try {
266                         Thread.sleep(5000);
267                 } catch (InterruptedException e1) {
268                         e1.printStackTrace();
269                 }
270                 this.thread.start();
271                 try {
272                         this.thread.join();
273                 } catch (InterruptedException e) {
274                         e.printStackTrace();
275                 }
276                 proxy.registerRenderInformation();
277                 Thread.yield();
278         }
279
280         @Override
281         public void run() {
282                 while (true) {
283                         if (proxy != null && instance != null) {
284                                 this.settingProcessing(event);
285                                 this.apiProcessing(event);
286                                 this.debug(event);
287                                 break;
288                         }
289                 }
290         }
291
292         private void settingProcessing(final FMLPostInitializationEvent event) {
293
294                 // Blockを追加します
295                 this.blockPyrolysisTable = new BlockPyrolysisTable(this.pyrolysisTableID, 0, Material.ground).
296                                 setHardness(2.0F).
297                                 setResistance(0.0F).
298                                 setStepSound(Block.soundStoneFootstep).
299                                 setBlockName("PyrolysisTable");
300                 this.blockElectrolysisTable = new BlockElectrolysisTable(this.electrolysisTableID, 1, Material.ground).
301                                 setHardness(2.0F).
302                                 setResistance(0.0F).
303                                 setStepSound(Block.soundStoneFootstep).
304                                 setBlockName("ElectrolysisTable");
305                 this.blockChemicalCombinationTable = new BlockChemicalCombinationTable(this.chemicalConbinationTableID, 2, Material.ground).
306                                 setHardness(2.0F).
307                                 setResistance(0.0F).
308                                 setStepSound(Block.soundStoneFootstep).
309                                 setBlockName("ChemicalCombinationTable");
310                 this.blockToolAndWeaponCraftingTable = new BlockToolAndWeaponCraftingTable(this.toolAndWeaponCraftingTableID, 3, Material.ground).
311                                 setHardness(2.0F).
312                                 setResistance(0.0F).
313                                 setStepSound(Block.soundStoneFootstep).
314                                 setBlockName("ToolAndWeaponCraftingTable");
315                 this.blockChemicalCraftingTable = new BlockChemicalCraftingTable(this.chemicalCraftingTableID, 4, Material.ground).
316                                 setHardness(2.0F).
317                                 setResistance(0.0F).
318                                 setStepSound(Block.soundStoneFootstep).
319                                 setBlockName("ChemicalCraftingTable");
320
321                 for (int i = 0; i < blockAtomOres.length; i++)
322                 {
323                         this.blockAtomOres[i] = new BlockAtomOres(this.atomOresID[i]).
324                                         setHardness(3.0F).
325                                         setResistance(0.0F).
326                                         setStepSound(Block.soundStoneFootstep).
327                                         setBlockName("AtomsOre" + i);
328                         GameRegistry.registerBlock(blockAtomOres[i], ItemAtomOres.class, "AtomsOre" + i);
329                         MinecraftForge.setBlockHarvestLevel(this.blockAtomOres[i], "pickaxe", 2);
330                 }
331
332                 // Itemを追加します
333                 this.itemAtoms = new ItemAtoms(this.atomsID).setItemName("atoms");
334                 this.itemCompounds = new ItemCompounds(this.compoundsID).setItemName("compounds");
335                 this.itemGasCollectingBottle = new ItemGasCollectingBottle(this.gasCollectingBottleID).setItemName("gasCollectingBottle").setIconIndex(0);
336                 this.itemAtomGrenade = new ItemAtomsGrenade(this.atomGrenadeID).setItemName("grenade").setIconIndex(1);
337                 this.itemChemicalCells = new ItemChemiCell(this.chemicalCellsID).setItemName("chemiCell").setIconIndex(3);
338                 this.itemDust = new ItemDust(15000).setItemName("dust").setIconIndex(12);
339                 this.itemRadiationGun = new ItemRadiationGun(this.radiationGunID).setIconIndex(4).setItemName("RadiationGun");
340                 this.itemRadiationBallet = new ItemRadiationBallet(this.radiationBalletID).setIconIndex(5).setItemName("RadiationBallet");
341
342
343                 // BlockをMinecraftに登録します
344                 GameRegistry.registerBlock(this.blockPyrolysisTable, "BlockPyrolysisTable");
345                 GameRegistry.registerBlock(this.blockChemicalCombinationTable, "BlockChemicalCombinationTable");
346                 GameRegistry.registerBlock(this.blockToolAndWeaponCraftingTable, "BlockToolAndWeaponCraftingTable");
347                 GameRegistry.registerBlock(this.blockChemicalCraftingTable, "BlockMaterialCraftingTable");
348                 GameRegistry.registerBlock(this.blockElectrolysisTable, "BlockElectrolysisTable");
349
350                 // Blockの名前を設定します
351                 this.nameAuxiliary.addName(this.blockPyrolysisTable, "PyrolysisTable");
352                 this.nameAuxiliary.addName(this.blockPyrolysisTable, "ja_JP", "熱分解台");
353                 this.nameAuxiliary.addName(this.blockChemicalCombinationTable, "ChemicalCombinationTable");
354                 this.nameAuxiliary.addName(this.blockChemicalCombinationTable, "ja_JP", "化合台");
355                 this.nameAuxiliary.addName(this.blockToolAndWeaponCraftingTable, "ToolAndWeaponCraftingTable");
356                 this.nameAuxiliary.addName(this.blockToolAndWeaponCraftingTable, "ja_JP", "ツール&武器製作台");
357                 this.nameAuxiliary.addName(this.blockChemicalCraftingTable, "ChemicalCraftingTable");
358                 this.nameAuxiliary.addName(this.blockChemicalCraftingTable, "ja_JP", "素材製作台");
359                 this.nameAuxiliary.addName(this.blockElectrolysisTable, "ElectrolysisTable");
360                 this.nameAuxiliary.addName(this.blockElectrolysisTable, "ja_JP", "電気分解台");
361
362                 // Itemの名前を設定します
363                 this.nameAuxiliary.addName(this.itemAtoms, ATOMSNAME);
364                 this.nameAuxiliary.addName(this.itemAtoms, "ja_JP", ATOMSNAMEJP);
365                 this.nameAuxiliary.addName(this.itemGasCollectingBottle, "GasCollectingBottle");
366                 this.nameAuxiliary.addName(this.itemGasCollectingBottle, "ja_JP", "集気瓶");
367                 this.nameAuxiliary.addName(this.itemAtomGrenade, "AtomGrenade");
368                 this.nameAuxiliary.addName(this.itemAtomGrenade, "ja_JP", "元素手榴弾");
369                 this.nameAuxiliary.addName(this.itemDust, "dust");
370                 this.nameAuxiliary.addName(this.itemDust, "ja_JP", "粉塵");
371                 this.nameAuxiliary.addName(this.itemRadiationGun, "RadiationGun");
372                 this.nameAuxiliary.addName(this.itemRadiationGun, "ja_JP", "放射線銃");
373                 this.nameAuxiliary.addName(this.itemRadiationBallet, "RadiationBallet");
374                 this.nameAuxiliary.addName(this.itemRadiationGun, "ja_JP", "放射線弾");
375
376                 // TileEntityを追加します
377                 GameRegistry.registerTileEntity(TileEntityPyrolysisTable.class, "TileEntityPyrolysisTable");
378                 GameRegistry.registerTileEntity(TileEntityChemicalCombinationTable.class, "TileEntityChemicalCombinationTable");
379                 GameRegistry.registerTileEntity(TileEntityToolAndWeaponCraftingTable.class, "TileEntityToolAndWeaponCraftingTable");
380                 GameRegistry.registerTileEntity(TileEntityChemicalCraftingTable.class, "TileEntityChemicalCraftingTable");
381                 GameRegistry.registerTileEntity(TileEntityElectrolysisTable.class, "TileEntityElectrolysisTable");
382
383                 // GUIを追加します
384                 NetworkRegistry.instance().registerGuiHandler(instance, proxy);
385
386                 //化学作業台類のレシピを追加します
387                 GameRegistry.addRecipe(new ItemStack(this.blockPyrolysisTable),
388                                 new Object[]{
389                         "XYX", "ZAZ", "ZZZ",
390                         Character.valueOf('X'), new ItemStack(Item.ingotIron),
391                         Character.valueOf('Y'), new ItemStack(Block.workbench),
392                         Character.valueOf('Z'), new ItemStack(Block.stone),
393                         Character.valueOf('A'), new ItemStack(Item.bucketLava),
394                 });
395                 GameRegistry.addRecipe(new ItemStack(this.blockChemicalCombinationTable),
396                                 new Object[]{
397                         "XYX", "ZAZ", "ZZZ",
398                         Character.valueOf('X'), new ItemStack(Item.ingotIron),
399                         Character.valueOf('Y'), new ItemStack(Block.workbench),
400                         Character.valueOf('Z'), new ItemStack(Block.stone),
401                         Character.valueOf('A'), new ItemStack(Block.obsidian),
402                 });
403                 GameRegistry.addRecipe(new ItemStack(this.blockToolAndWeaponCraftingTable),
404                                 new Object[]{
405                         "XYX", "ZAZ", "ZZZ",
406                         Character.valueOf('X'), new ItemStack(Item.ingotIron),
407                         Character.valueOf('Y'), new ItemStack(Block.workbench),
408                         Character.valueOf('Z'), new ItemStack(Block.stone),
409                         Character.valueOf('A'), new ItemStack(Item.pickaxeSteel),
410                 });
411                 GameRegistry.addRecipe(new ItemStack(this.blockChemicalCraftingTable),
412                                 new Object[]{
413                         "XYX", "ZAZ", "ZZZ",
414                         Character.valueOf('X'), new ItemStack(Item.ingotIron),
415                         Character.valueOf('Y'), new ItemStack(Block.workbench),
416                         Character.valueOf('Z'), new ItemStack(Block.stone),
417                         Character.valueOf('A'), new ItemStack(this.itemAtoms, 1, 0),
418                 });
419
420                 //電池を追加します
421                 api.addChemicalCell(itemChemicalCells, "ChemicalCell", 1000);
422                 api.addChemicalCellLanguage("ChemicalCell", "ja_JP", "化学電池");
423
424                 // 元素入手手段
425
426                 // 水素
427                 // 水を分解。
428
429                 // ヘリウム
430                 // 未定。
431
432                 // リチウム
433                 api.addAtomOres(
434                                 "LithiumOre",
435                                 new String[] { "Li", "Al", "Si", "O" },
436                                 new Integer[] { 1, 1, 4, 10 },
437                                 this.atomOresID[api.getAtomOresLastIndex()],
438                                 8,
439                                 EnumOreSpawnFrequency.NORMAL);
440                 // LiAlSi4O10
441                 api.addAtomOresLanguage("LithiumOre", "リチウム鉱石", "ja_JP");
442
443                 // ベリリウム
444                 api.addAtomOres(
445                                 "BerylliumOre",
446                                 new String[] { "Be", "Al", "Si", "O" },
447                                 new Integer[] { 3, 2, 6, 18 },
448                                 this.atomOresID[api.getAtomOresLastIndex()],
449                                 8,
450                                 EnumOreSpawnFrequency.NORMAL);
451                 // Be3Al2Si6O18
452                 api.addAtomOresLanguage("BerylliumOre", "ベリリウム鉱石", "ja_JP");
453
454                 // ホウ素
455                 api.addAtomOres(
456                                 "BoronOre",
457                                 new String[] { "Na", "Ca", "B", "O", "H" },
458                                 new Integer[] { 1, 1, 5, 17, 16 },
459                                 this.atomOresID[api.getAtomOresLastIndex()],
460                                 8,
461                                 EnumOreSpawnFrequency.NORMAL);
462                 // NaCaB5O6(OH)6・5H2O
463                 api.addAtomOresLanguage("BoronOre", "ホウ素鉱石", "ja_JP");
464
465                 // 炭素
466                 api.addPyrolysisDecompositionRecipe(
467                                 new ItemStack(Block.oreCoal),
468                                 new Integer[] { chemicalData.CARBON },
469                                 new Integer[] { 1 });
470
471                 // フッ素
472                 api.addAtomOres(
473                                 "FluorineOre",
474                                 new String[] { "Ca", "F" },
475                                 new Integer[] { 1, 2 },
476                                 this.atomOresID[api.getAtomOresLastIndex()],
477                                 8,
478                                 EnumOreSpawnFrequency.NORMAL);
479                 // CaF2
480                 api.addAtomOresLanguage("FluorineOre", "フッ素鉱石", "ja_JP");
481
482                 // ナトリウム
483                 api.addAtomOres(
484                                 "SodiumOre",
485                                 new String[] { "Na", "Cl" },
486                                 new Integer[] { 1, 1 },
487                                 this.atomOresID[api.getAtomOresLastIndex()],
488                                 8,
489                                 EnumOreSpawnFrequency.NORMAL);
490                 // NaCl
491                 api.addAtomOresLanguage("SodiumOre", "ナトリウム鉱石", "ja_JP");
492
493                 // マグネシウム
494                 api.addAtomOres(
495                                 "MagnesiumOre",
496                                 new String[] { "Ca", "Mg", "C", "O" },
497                                 new Integer[] { 1, 1, 2, 6 },
498                                 this.atomOresID[api.getAtomOresLastIndex()],
499                                 8,
500                                 EnumOreSpawnFrequency.NORMAL);
501                 // CaMg(CO3)2
502                 api.addAtomOresLanguage("MagnesiumOre", "マグネシウム鉱石", "ja_JP");
503
504                 // アルミニウム
505                 api.addAtomOres(
506                                 "AluminiumOre",
507                                 new String[] { "Al", "O", "H" },
508                                 new Integer[] { 3, 3, 3 },
509                                 this.atomOresID[api.getAtomOresLastIndex()],
510                                 8,
511                                 EnumOreSpawnFrequency.NORMAL);
512                 // Al(OH)3
513                 api.addAtomOresLanguage("AluminiumOre", "アルミニウム鉱石", "ja_JP");
514
515                 // ケイ素
516                 // 1.5まで保留。
517
518                 // リン
519                 api.addAtomOres(
520                                 "PhosphorusOre",
521                                 new String[] { "Ca", "P", "O", "F" },
522                                 new Integer[] { 5, 3, 12, 1 },
523                                 this.atomOresID[api.getAtomOresLastIndex()],
524                                 8,
525                                 EnumOreSpawnFrequency.NORMAL);
526                 // Ca5(PO4)3F
527                 api.addAtomOresLanguage("PhosphorusOre", "リン鉱石", "ja_JP");
528
529                 // 硫黄
530                 api.addAtomOres(
531                                 "SulfurOre",
532                                 new String[] { "S" },
533                                 new Integer[] { 1 },
534                                 this.atomOresID[api.getAtomOresLastIndex()],
535                                 8,
536                                 EnumOreSpawnFrequency.NORMAL);
537                 // S
538                 api.addAtomOresLanguage("SulfurOre", "硫黄鉱石", "ja_JP");
539
540                 // カリウム
541                 api.addAtomOres(
542                                 "PotassiumOre",
543                                 new String[] { "K", "Cl" },
544                                 new Integer[] { 1, 1 },
545                                 this.atomOresID[api.getAtomOresLastIndex()],
546                                 8,
547                                 EnumOreSpawnFrequency.NORMAL);
548                 // KCl
549                 api.addAtomOresLanguage("PotassiumOre", "カリウム鉱石", "ja_JP");
550
551                 // カルシウム
552                 api.addAtomOres(
553                                 "CalciumOre",
554                                 new String[] { "Ca", "C", "O" },
555                                 new Integer[] { 1, 1, 3 },
556                                 this.atomOresID[api.getAtomOresLastIndex()],
557                                 8,
558                                 EnumOreSpawnFrequency.NORMAL);
559                 // CaCO3
560                 api.addAtomOresLanguage("CalciumOre", "カルシウム鉱石", "ja_JP");
561
562                 // スカンジウム
563                 api.addAtomOres(
564                                 "ScandiumOre",
565                                 new String[] { "Sc", "Y", "Si", "O" },
566                                 new Integer[] { 2, 2, 2, 7 },
567                                 this.atomOresID[api.getAtomOresLastIndex()],
568                                 8,
569                                 EnumOreSpawnFrequency.NORMAL);
570                 // (Sc,Y)2Si2O7
571                 api.addAtomOresLanguage("ScandiumOre", "スカンジウム鉱石", "ja_JP");
572
573                 // チタン
574                 api.addAtomOres(
575                                 "TitaniumOre",
576                                 new String[] { "Ti", "O" },
577                                 new Integer[] { 1, 2 },
578                                 this.atomOresID[api.getAtomOresLastIndex()],
579                                 8,
580                                 EnumOreSpawnFrequency.NORMAL);
581                 // TiO2
582                 api.addAtomOresLanguage("TitaniumOre", "チタン鉱石", "ja_JP");
583
584                 // バナジウム
585                 api.addAtomOres(
586                                 "VanadiumOre",
587                                 new String[] { "K", "U", "O", "V", "H" },
588                                 new Integer[] { 2, 2, 15, 2, 6 },
589                                 this.atomOresID[api.getAtomOresLastIndex()],
590                                 8,
591                                 EnumOreSpawnFrequency.NORMAL);
592                 // K2(UO2)2V2O8・3H2O
593                 api.addAtomOresLanguage("VanadiumOre", "バナジウム鉱石", "ja_JP");
594
595                 // クロム
596                 api.addAtomOres(
597                                 "Chromium",
598                                 new String[] { "Fe", "Cr", "O" },
599                                 new Integer[] { 1, 2, 4 },
600                                 this.atomOresID[api.getAtomOresLastIndex()],
601                                 8,
602                                 EnumOreSpawnFrequency.NORMAL);
603                 api.addAtomOresLanguage("Chromium", "クロム鉱石", "ja_JP");
604                 // FeCr2O4
605
606                 // マンガン
607                 api.addAtomOres(
608                                 "ManganeseOre",
609                                 new String[] { "Mn", "O" },
610                                 new Integer[] { 1, 2 },
611                                 this.atomOresID[api.getAtomOresLastIndex()],
612                                 8,
613                                 EnumOreSpawnFrequency.NORMAL);
614                 api.addAtomOresLanguage("ManganeseOre", "ja_JP", "マンガン鉱石");
615                 // MnO2
616
617                 // コバルト
618                 api.addAtomOres(
619                                 "CobaltOre",
620                                 new String[] { "Co", "As", "S" },
621                                 new Integer[] { 1, 1, 1 },
622                                 this.atomOresID[api.getAtomOresLastIndex()],
623                                 8,
624                                 EnumOreSpawnFrequency.NORMAL);
625                 api.addAtomOresLanguage("CobaltOre", "ja_JP", "コバルト鉱石");
626                 // CoAsS
627
628                 // api.addAtomOres("元素名(英)", new String[]{"元素"}, new Integer[]{<数>}, this.atomOresID[api.getAtomOresLastIndex()], 8, EnumOreSpawnFrequency.NORMAL); // 化学式
629                 // api.addAtomOresLanguage("元素名(英)", "元素名(他国語)", "言語");
630
631                 //化合物を追加します
632                 this.api.addCompound("ja_JP", "ChlorousAcid", "亜塩素酸");
633                 this.api.addCompound("ja_JP", "CarbonMonoxide", "一酸化炭素");
634                 this.api.addCompound("ja_JP", "CarbonDioxide", "二酸化炭素");
635                 this.api.addCompound("ja_JP", "Water", "水");
636                 this.api.addCompound("ja_JP", "SodiumChloride", "塩化ナトリウム");
637                 this.api.addCompound("ja_JP", "SodiumBicarbonate", "重曹");
638
639                 //化合物のHandlerを設定します
640                 this.api.settingCompoundHandler("Water", new CompoundWater());
641
642                 //化合物のレシピを追加します
643                 this.api.addChemicalCombinationRecipe(new String[]{"Na", "O", "H"}, new Integer[]{1, 1, 1}, new ItemStack(this.itemCompounds, 1, this.api.getCompound("SodiumChloride")));
644                 this.api.addChemicalCombinationRecipe(new String[]{"H", "O", "Cl"}, new Integer[]{1, 2, 1}, new ItemStack(this.itemCompounds, 1, this.api.getCompound("ChlorousAcid")));
645                 this.api.addChemicalCombinationRecipe(new String[]{"H", "O"}, new Integer[]{2, 1}, new ItemStack(this.itemCompounds, 1, this.api.getCompound("Water")));
646
647                 //化学電池の追加
648                 this.api.addMaterialRecipe(new ItemStack[] {
649                                 null,
650                                 null,
651                                 null,
652                                 new ItemStack(this.itemAtoms, 1, chemicalData.ZINC),
653                                 null,
654                                 new ItemStack(this.itemAtoms, 1, chemicalData.COPPER),
655                                 new ItemStack(Item.bucketWater),
656                                 new ItemStack(Item.bucketWater),
657                                 new ItemStack(Item.bucketWater),
658                 },
659                 new ItemStack(this.itemChemicalCells, 1, 0),
660                 null);
661
662                 //手榴弾の追加
663                 this.api.addMaterialRecipe(new ItemStack[] {
664                                 null,
665                                 new ItemStack(Block.stone),
666                                 null,
667                                 new ItemStack(Block.stone),
668                                 new ItemStack(Item.gunpowder),
669                                 new ItemStack(Block.stone),
670                                 null,
671                                 new ItemStack(Block.stone),
672                                 null
673                 },
674                 new ItemStack(this.itemAtomGrenade, 16, 0),
675                 new NBTRecipeGrenade()
676                                 );
677
678                 this.api.addPyrolysisDecompositionRecipe(new ItemStack(Item.potion, 1, 0),
679                                 new Integer[] {ChemiCraftData.HYDROGEN, chemicalData.OXYGEN},
680                                 new Integer[] {2, 1});
681
682                 this.api.addPyrolysisDecompositionRecipe(new ItemStack(this.itemCompounds, 1, this.api.getCompound("Water")),
683                                 new Integer[] {ChemiCraftData.HYDROGEN, chemicalData.OXYGEN},
684                                 new Integer[] {2, 1});
685
686                 for (int i = 0; i < api.getAtomOresName().sizeKeysList(); i++){
687                         this.api.addPyrolysisDecompositionRecipe(new ItemStack(this.blockAtomOres[i / 16], 1, i - i / 16 * 16),
688                                         api.getAtomOresAtoms().get(api.getAtomOresName().getKeyList(i)),
689                                         api.getAtomOresAmounts().get(api.getAtomOresName().getKeyList(i)));
690                 }
691
692                 //Entityを追加
693                 LanguageRegistry.instance().addStringLocalization("entity.Dust.name", "en_US", "Dust");
694                 EntityRegistry.registerModEntity(EntityDust.class,
695                                 "Dust",
696                                 ModLoader.getUniqueEntityId(),
697                                 this,
698                                 250,
699                                 5,
700                                 true);
701
702                 this.api.addPyrolysisDecompositionFuel(new ItemStack(Item.coal), 2000*8);
703         }
704
705         private void apiProcessing(final FMLPostInitializationEvent event) {
706                 // API用の処理
707                 for (int i = 0; i < api.getAtomOresName().sizeKeysList(); i++)
708                 {
709                         for (int j = 0; j < api.getAtomOresName().sizeElementsList(api.getAtomOresName().getKeyList(i)); j++)
710                         {
711                                 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));
712                                 OreDictionary.registerOre("ore" + api.getAtomOresName().getKeyList(i), new ItemStack(blockAtomOres[i / 16], 1, i - i / 16 * 16));
713                         }
714                 }
715
716                 for (int i = 0; i < api.getAtomOres().size(); i++)
717                 {
718                         GameRegistry.registerWorldGenerator(api.getAtomOres().get(i));
719                 }
720
721                 for (int i = 0; i < api.getChemicalCellsName().sizeKeysList(); i++)
722                 {
723                         for (int j = 0; j < api.getChemicalCellsName().sizeElementsList(api.getChemicalCellsName().getKeyList(i)); j++)
724                         {
725                                 this.nameAuxiliary.addName(new ItemStack(itemChemicalCells, 0, i), api.getChemicalCellsLanguage().get(api.getChemicalCellsName().getKeyList(i), j), api.getChemicalCellsName().get(api.getChemicalCellsName().getKeyList(i), j));
726                         }
727                 }
728
729                 for (int i = 0; i < api.getCompoundsName().sizeKeysList(); i++)
730                 {
731                         for (int j = 0; j < api.getCompoundsName().sizeElementsList(api.getCompoundsName().getKeyList(i)); j++)
732                         {
733                                 this.nameAuxiliary.addName(new ItemStack(itemCompounds, 0, i), api.getCompoundsLang().get(api.getCompoundsName().getKeyList(i), j), api.getCompoundsName().get(api.getCompoundsName().getKeyList(i), j));
734                         }
735                 }
736
737         }
738
739         private void debug(final FMLPostInitializationEvent event) {
740                 this.proxy.registerTickHandler();
741                 this.api.addCompound("Debug");
742                 this.api.settingCompoundHandler("Debug", new CompoundDebug());
743
744                 this.api.addToolAndWeaponRecipe(new ItemStack[] {
745                                 new ItemStack(Block.stone, 1, 1)
746                 },
747                 new ItemStack(Block.dirt, 1, 0));
748
749         }
750
751 }