OSDN Git Service

文字コードをSJISからUTF8へ
[chemicraft/chemicraft.git] / 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.event.FMLInitializationEvent;\r
14 import cpw.mods.fml.common.event.FMLPostInitializationEvent;\r
15 import cpw.mods.fml.common.event.FMLPreInitializationEvent;\r
16 import cpw.mods.fml.common.network.NetworkMod;\r
17 import cpw.mods.fml.common.registry.GameRegistry;\r
18 import cpw.mods.fml.common.registry.LanguageRegistry;\r
19 \r
20 @Mod( modid = "chemiCraft", name="ChemiCraft", version="テスト版") //ID,名前,バージョン\r
21 @NetworkMod(clientSideRequired = true, serverSideRequired = true, versionBounds = "[1.3.2]", packetHandler = PacketHandler.class) //クライアント、サーバー共に必要 1.3.2用\r
22 \r
23 public class ChemiCraft\r
24 {\r
25 \r
26         public static final CreativeTabs tabAtoms = new CreativeTabAtoms("tabAtoms");\r
27 \r
28         public static final String[] atomsName = {\r
29                 "Hydrogen", "Helium","Lithium","Beryllium","Boron","Carbon","Nitrogen","Oxygen","Fluorine","Neon",\r
30                 "Sodium","Magnesium","Aluminium","Silicon","Phosphorus","Sulfur","Chlorine","Argon","Potassium","Calcium",\r
31                 "Scandium","Titanium","Vanadium","Chromium","Manganese","Iron","Cobalt","Nickel","Copper","Zinc",\r
32                 "Gallium","Germanium","Arsenic","Selenium","Bromine","Krypton","Rubidium","Strontium","Yttorium","Zirconium",\r
33                 "Niobium","Molybdenum","Technetium","Ruthenium","Rhodium","Palladium","Silver","Cadmium","Indium","Tin",\r
34                 "Antimony","Tellurium","Iodine","Xenon","Caesium","Barium","Lanthanum","Cerium","Praseodymium","Neodymium",\r
35                 "Promethium","Samarium","Europium","Gadolinium","Terbium","Dysprosium","Holmium","Erbium","Thulium","Ytterbium",\r
36                 "Lutetium","Hafnium","Tantalum","Tungsten","Rhenium","Osmium","Iridium","Platinum","Gold","Mercury",\r
37                 "Thallium","Lead","Bismuth","Polonium","Astatine","Radon","Francium","Radium","Actinium","Thorium",\r
38                 "Protactinium","Uranium","Neptunium","Plutonium","Americium","Curium","Berkelium","Californium","Einsteinium","Fermium",\r
39                 "Mendelevium","Nobelium","Lawrencium","Rutherfordium","Dubnium","Seaborgium","Bohrium","Hassium","Meitnerium","Darmstadtium",\r
40                 "Roentgenium","Copernicium","Ununtrium","Ununquadium","Ununpentium","Ununhexium","","Ununoctium"\r
41         };\r
42 \r
43         public static final String[] atomsNameJP = {\r
44                 "水素", "ヘリウム", "リチウム", "ベリウム", "ホウ素", "炭素", "窒素", "酸素", "フッ素", "ネオン",\r
45                 "ナトリウム", "マグネシウム", "アルミニウム", "ケイ素", "リン", "硫黄", "塩素", "アルゴン", "カリウム", "カルシウム",\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         private ChemiCraftAPI chemiCraftAPI = ChemiCraftAPI.instance;\r
59 \r
60         public static int gasCollectingBottleID;\r
61         public static int atomsID;\r
62         public static int compoundsID;\r
63 \r
64         public static Item itemGasCollectingBottle;\r
65         public static Item itemAtoms;\r
66         public static Item itemCompounds;\r
67 \r
68         private Auxiliary Auxiliary = new Auxiliary();\r
69         private Auxiliary.NameAuxiliary NameAuxiliary = Auxiliary.new NameAuxiliary();\r
70 \r
71         // コンストラクタ\r
72         @Mod.Init\r
73         public void chemiLoadMethod(FMLInitializationEvent event)\r
74         {\r
75 \r
76                 //化合物の追加\r
77                 ChemiCraftAPI.addLangCompound("ja_JP", "Salt", "塩");\r
78         }\r
79 \r
80         @Mod.PreInit  // 前処理\r
81         public void chemiPreLoadMethod(FMLPreInitializationEvent event)\r
82         {\r
83                 Configuration cfg = new Configuration(event.getSuggestedConfigurationFile());\r
84                 cfg.load();\r
85                 Property gasCollectingBottleIDProp = cfg.getItem("gasCollectingBottleID", 25000);\r
86                 Property atomsIDProp = cfg.getItem("atomsID", 25001);\r
87                 Property compoundsIDProp = cfg.getItem("compoundsID", 25002);\r
88                 gasCollectingBottleID = gasCollectingBottleIDProp.getInt();\r
89                 atomsID = atomsIDProp.getInt();\r
90                 compoundsID = compoundsIDProp.getInt();\r
91                 cfg.save();\r
92         }\r
93 \r
94         @Mod.PostInit // ModLoader.loadメソッドと同等\r
95         public void chemiPostLoadMethod(FMLPostInitializationEvent event)\r
96         {\r
97                 itemGasCollectingBottle = new ItemGasCollectingBottle(gasCollectingBottleID).setItemName("gasCollectingBottle");\r
98                 itemAtoms = new ItemAtoms(atomsID).setItemName("atoms");\r
99                 itemCompounds = new ItemCompounds(compoundsID).setItemName("compounds");\r
100 \r
101                 NameAuxiliary.addName(itemAtoms, atomsName);\r
102                 NameAuxiliary.addName(itemAtoms, "ja_JP", atomsNameJP);\r
103                 NameAuxiliary.addName(itemCompounds, ChemiCraftAPI.getCompoundsName().toArray());\r
104                 NameAuxiliary.addName(itemCompounds, "ja_JP", ChemiCraftAPI.getCompoundsLangName().toArray());\r
105                 NameAuxiliary.addName(itemGasCollectingBottle, "GasCollectingBottle");\r
106                 NameAuxiliary.addName(itemGasCollectingBottle, "ja_JP", "集気瓶");\r
107 \r
108                 ChemiCraftAPI.addCompoundHandler("Salt", new CompoundHandlerTest());\r
109 \r
110         }\r
111 \r
112 }