OSDN Git Service

f9ea79939292003710b814aedb45e8c20ddc2b84
[chemicraft/chemicraft.git] / common / chemicraft / ChemiCraft.java
1 package chemicraft;\r
2 \r
3 import java.util.ArrayList;\r
4 import java.util.Properties;\r
5 \r
6 import net.minecraft.src.Block;\r
7 import net.minecraft.src.CreativeTabs;\r
8 import net.minecraft.src.Item;\r
9 import net.minecraft.src.ItemStack;\r
10 import net.minecraftforge.common.Configuration;\r
11 import net.minecraftforge.common.Property;\r
12 import cpw.mods.fml.common.Mod;\r
13 import cpw.mods.fml.common.Mod.Instance;\r
14 import cpw.mods.fml.common.SidedProxy;\r
15 import cpw.mods.fml.common.event.FMLInitializationEvent;\r
16 import cpw.mods.fml.common.event.FMLPostInitializationEvent;\r
17 import cpw.mods.fml.common.event.FMLPreInitializationEvent;\r
18 import cpw.mods.fml.common.network.NetworkMod;\r
19 import cpw.mods.fml.common.registry.GameRegistry;\r
20 import cpw.mods.fml.common.registry.LanguageRegistry;\r
21 \r
22 @Mod( modid = "chemiCraft", name="ChemiCraft", version="テスト版") //ID,名前,バージョン\r
23 @NetworkMod(clientSideRequired = true, serverSideRequired = true, versionBounds = "[1.3.2]", packetHandler = PacketHandler.class) //クライアント、サーバー共に必要 1.3.2用\r
24 \r
25 public class ChemiCraft\r
26 {\r
27 \r
28         public static final CreativeTabs tabAtoms = new CreativeTabAtoms("tabAtoms");\r
29 \r
30         public static final String[] atomsName = {\r
31                 "Hydrogen", "Helium","Lithium","Beryllium","Boron","Carbon","Nitrogen","Oxygen","Fluorine","Neon",\r
32                 "Sodium","Magnesium","Aluminium","Silicon","Phosphorus","Sulfur","Chlorine","Argon","Potassium","Calcium",\r
33                 "Scandium","Titanium","Vanadium","Chromium","Manganese","Iron","Cobalt","Nickel","Copper","Zinc",\r
34                 "Gallium","Germanium","Arsenic","Selenium","Bromine","Krypton","Rubidium","Strontium","Yttorium","Zirconium",\r
35                 "Niobium","Molybdenum","Technetium","Ruthenium","Rhodium","Palladium","Silver","Cadmium","Indium","Tin",\r
36                 "Antimony","Tellurium","Iodine","Xenon","Caesium","Barium","Lanthanum","Cerium","Praseodymium","Neodymium",\r
37                 "Promethium","Samarium","Europium","Gadolinium","Terbium","Dysprosium","Holmium","Erbium","Thulium","Ytterbium",\r
38                 "Lutetium","Hafnium","Tantalum","Tungsten","Rhenium","Osmium","Iridium","Platinum","Gold","Mercury",\r
39                 "Thallium","Lead","Bismuth","Polonium","Astatine","Radon","Francium","Radium","Actinium","Thorium",\r
40                 "Protactinium","Uranium","Neptunium","Plutonium","Americium","Curium","Berkelium","Californium","Einsteinium","Fermium",\r
41                 "Mendelevium","Nobelium","Lawrencium","Rutherfordium","Dubnium","Seaborgium","Bohrium","Hassium","Meitnerium","Darmstadtium",\r
42                 "Roentgenium","Copernicium","Ununtrium","Ununquadium","Ununpentium","Ununhexium","","Ununoctium"\r
43         };\r
44 \r
45         public static final String[] atomsNameJP = {\r
46                 "水素", "ヘリウム", "リチウム", "ベリウム", "ホウ素", "炭素", "窒素", "酸素", "フッ素", "ネオン",\r
47                 "ナトリウム", "マグネシウム", "アルミニウム", "ケイ素", "リン", "硫黄", "塩素", "アルゴン", "カリウム", "カルシウム",\r
48                 "スカンジウム", "チタン", "バナジウム", "クロム", "マンガン", "鉄", "コバルト", "ニッケル", "銅", "亜鉛",\r
49                 "ガリウム", "ゲルマニウム", "ヒ素", "セレン", "臭素", "クリプトン", "ルビジウム", "ストロンチウム", "イットリウム", "ジルコニウム",\r
50                 "ニオブ", "モリブデン", "テクネチウム", "ルテニウム", "ロジウム", "パラジウム", "銀", "カドミウム", "インジウム", "スズ",\r
51                 "アンチモン", "テルル", "ヨウ素", "キセノン", "セシウム", "バリウム", "ランタン", "セリウム", "プラセオジム", "ネオジム",\r
52                 "プロメチウム", "サマリウム", "ユウロビウム", "ガドリニウム", "テルビウム", "ジスプロニウム", "ホルミウム", "エルビウム", "ツリウム", "イッテルビウム",\r
53                 "ルテチウム", "ハフニウム", "タンタル", "タングステン", "レニウム", "オスミウム", "イリジウム", "白金", "金", "水銀",\r
54                 "タリウム", "鉛", "ビスマス", "ポロニウム", "アスタチン", "ラドン", "フランシウム", "ラジウム", "アクチニウム", "トリウム",\r
55                 "プロトアクチウム", "ウラン", "ネプツニウム", "プルトニウム", "アメリシウム", "キュリウム", "バークリウム", "カルホルニウム", "アインスタイニウム", "フェルミウム",\r
56                 "メンデレビウム", "ノーベリウム", "ローレンシウム", "ラサホージウム", "ドブニウム", "シーボーギウム", "ボーリウム", "ハッシウム", "マイトネリウム", "ダームスタチウム",\r
57                 "レントゲニウム", "コペルニシウム", "ウンウントリウム", "フレロビウム", "ウンウンペンチウム", "リバモリウム", "ウンウンセプチウム", "ウンウンオクチウム"\r
58         };\r
59 \r
60         // プロキシ\r
61         @SidedProxy(clientSide = "chemicraft.client.ClientProxy", serverSide = "chemicraft.CommonProxy")\r
62         public static CommonProxy proxy;\r
63         \r
64         // このクラスのインスタンス\r
65         @Instance("chemiCraft")\r
66         public static ChemiCraft instance;\r
67         \r
68         private ChemiCraftAPI chemiCraftAPI = ChemiCraftAPI.instance;\r
69 \r
70         public static int gasCollectingBottleID;\r
71         public static int atomsID;\r
72         public static int compoundsID;\r
73 \r
74         public static Item itemGasCollectingBottle;\r
75         public static Item itemAtoms;\r
76         public static Item itemCompounds;\r
77 \r
78         private Auxiliary Auxiliary = new Auxiliary();\r
79         private Auxiliary.NameAuxiliary NameAuxiliary = Auxiliary.new NameAuxiliary();\r
80 \r
81         // コンストラクタ\r
82         @Mod.Init\r
83         public void chemiLoadMethod(FMLInitializationEvent event)\r
84         {\r
85 \r
86                 //化合物の追加\r
87                 ChemiCraftAPI.addLangCompound("ja_JP", "Salt", "塩");\r
88         }\r
89 \r
90         @Mod.PreInit  // 前処理\r
91         public void chemiPreLoadMethod(FMLPreInitializationEvent event)\r
92         {\r
93                 Configuration cfg = new Configuration(event.getSuggestedConfigurationFile());\r
94                 cfg.load();\r
95                 Property gasCollectingBottleIDProp = cfg.getItem("gasCollectingBottleID", 25000);\r
96                 Property atomsIDProp = cfg.getItem("atomsID", 25001);\r
97                 Property compoundsIDProp = cfg.getItem("compoundsID", 25002);\r
98                 gasCollectingBottleID = gasCollectingBottleIDProp.getInt();\r
99                 atomsID = atomsIDProp.getInt();\r
100                 compoundsID = compoundsIDProp.getInt();\r
101                 cfg.save();\r
102         }\r
103 \r
104         @Mod.PostInit // ModLoader.loadメソッドと同等\r
105         public void chemiPostLoadMethod(FMLPostInitializationEvent event)\r
106         {\r
107                 itemGasCollectingBottle = new ItemGasCollectingBottle(gasCollectingBottleID).setItemName("gasCollectingBottle");\r
108                 itemAtoms = new ItemAtoms(atomsID).setItemName("atoms");\r
109                 itemCompounds = new ItemCompounds(compoundsID).setItemName("compounds");\r
110 \r
111                 NameAuxiliary.addName(itemAtoms, atomsName);\r
112                 NameAuxiliary.addName(itemAtoms, "ja_JP", atomsNameJP);\r
113                 NameAuxiliary.addName(itemCompounds, ChemiCraftAPI.getCompoundsName().toArray());\r
114                 NameAuxiliary.addName(itemCompounds, "ja_JP", ChemiCraftAPI.getCompoundsLangName().toArray());\r
115                 NameAuxiliary.addName(itemGasCollectingBottle, "GasCollectingBottle");\r
116                 NameAuxiliary.addName(itemGasCollectingBottle, "ja_JP", "集気瓶");\r
117 \r
118                 ChemiCraftAPI.addCompoundHandler("Salt", new CompoundHandlerTest());\r
119 \r
120         }\r
121 \r
122 }