OSDN Git Service

変更点をそのままにして修正し、間違っているところを消去&修正
[chemicraft/chemicraft.git] / common / chemicraft / ChemiCraft.java
1 package chemicraft;\r
2 \r
3 import net.minecraft.src.Block;\r
4 import net.minecraft.src.CreativeTabs;\r
5 import net.minecraft.src.Item;\r
6 import net.minecraft.src.Material;\r
7 import net.minecraftforge.common.Configuration;\r
8 import net.minecraftforge.common.Property;\r
9 import chemicraft.Auxiliary.NameAuxiliary;\r
10 import cpw.mods.fml.common.Mod;\r
11 import cpw.mods.fml.common.SidedProxy;\r
12 import cpw.mods.fml.common.event.FMLPostInitializationEvent;\r
13 import cpw.mods.fml.common.event.FMLPreInitializationEvent;\r
14 import cpw.mods.fml.common.network.NetworkMod;\r
15 import cpw.mods.fml.common.network.NetworkRegistry;\r
16 import cpw.mods.fml.common.registry.GameRegistry;\r
17 \r
18 @Mod( modid = "chemiCraft", name="ChemiCraft", version="テスト版") //ID,名前,バージョン\r
19 @NetworkMod(clientSideRequired = true, serverSideRequired = true, versionBounds = "[1.3.2]", packetHandler = PacketHandler.class) //クライアント、サーバー共に必要 1.3.2用\r
20 \r
21 public class ChemiCraft\r
22 {\r
23 \r
24         public static final String[] atomsName = {\r
25                 "Hydrogen", "Helium","Lithium","Beryllium","Boron","Carbon","Nitrogen","Oxygen","Fluorine","Neon",\r
26                 "Sodium","Magnesium","Aluminium","Silicon","Phosphorus","Sulfur","Chlorine","Argon","Potassium","Calcium",\r
27                 "Scandium","Titanium","Vanadium","Chromium","Manganese","Iron","Cobalt","Nickel","Copper","Zinc",\r
28                 "Gallium","Germanium","Arsenic","Selenium","Bromine","Krypton","Rubidium","Strontium","Yttorium","Zirconium",\r
29                 "Niobium","Molybdenum","Technetium","Ruthenium","Rhodium","Palladium","Silver","Cadmium","Indium","Tin",\r
30                 "Antimony","Tellurium","Iodine","Xenon","Caesium","Barium","Lanthanum","Cerium","Praseodymium","Neodymium",\r
31                 "Promethium","Samarium","Europium","Gadolinium","Terbium","Dysprosium","Holmium","Erbium","Thulium","Ytterbium",\r
32                 "Lutetium","Hafnium","Tantalum","Tungsten","Rhenium","Osmium","Iridium","Platinum","Gold","Mercury",\r
33                 "Thallium","Lead","Bismuth","Polonium","Astatine","Radon","Francium","Radium","Actinium","Thorium",\r
34                 "Protactinium","Uranium","Neptunium","Plutonium","Americium","Curium","Berkelium","Californium","Einsteinium","Fermium",\r
35                 "Mendelevium","Nobelium","Lawrencium","Rutherfordium","Dubnium","Seaborgium","Bohrium","Hassium","Meitnerium","Darmstadtium",\r
36                 "Roentgenium","Copernicium","Ununtrium","Ununquadium","Ununpentium","Ununhexium","","Ununoctium"\r
37         };\r
38 \r
39         public static final String[] atomsNameJP = {\r
40                 "水素", "ヘリウム", "リチウム", "ベリウム", "ホウ素", "炭素", "窒素", "酸素", "フッ素", "ネオン",\r
41                 "ナトリウム", "マグネシウム", "アルミニウム", "ケイ素", "リン", "硫黄", "塩素", "アルゴン", "カリウム", "カルシウム",\r
42                 "スカンジウム", "チタン", "バナジウム", "クロム", "マンガン", "鉄", "コバルト", "ニッケル", "銅", "亜鉛",\r
43                 "ガリウム", "ゲルマニウム", "ヒ素", "セレン", "臭素", "クリプトン", "ルビジウム", "ストロンチウム", "イットリウム", "ジルコニウム",\r
44                 "ニオブ", "モリブデン", "テクネチウム", "ルテニウム", "ロジウム", "パラジウム", "銀", "カドミウム", "インジウム", "スズ",\r
45                 "アンチモン", "テルル", "ヨウ素", "キセノン", "セシウム", "バリウム", "ランタン", "セリウム", "プラセオジム", "ネオジム",\r
46                 "プロメチウム", "サマリウム", "ユウロビウム", "ガドリニウム", "テルビウム", "ジスプロニウム", "ホルミウム", "エルビウム", "ツリウム", "イッテルビウム",\r
47                 "ルテチウム", "ハフニウム", "タンタル", "タングステン", "レニウム", "オスミウム", "イリジウム", "白金", "金", "水銀",\r
48                 "タリウム", "鉛", "ビスマス", "ポロニウム", "アスタチン", "ラドン", "フランシウム", "ラジウム", "アクチニウム", "トリウム",\r
49                 "プロトアクチウム", "ウラン", "ネプツニウム", "プルトニウム", "アメリシウム", "キュリウム", "バークリウム", "カルホルニウム", "アインスタイニウム", "フェルミウム",\r
50                 "メンデレビウム", "ノーベリウム", "ローレンシウム", "ラサホージウム", "ドブニウム", "シーボーギウム", "ボーリウム", "ハッシウム", "マイトネリウム", "ダームスタチウム",\r
51                 "レントゲニウム", "コペルニシウム", "ウンウントリウム", "ウンウンクアジウム", "ウンウンペンチウム", "ウンウンヘキシウム", "", "ウンウンオクチウム"\r
52         };\r
53 \r
54         /**\r
55          * このmodのインスタンス\r
56          */\r
57         @Mod.Instance("chemiCraft")\r
58         public static ChemiCraft instance;\r
59 \r
60         /**\r
61          * ChemiCraftのProxy\r
62          */\r
63         @SidedProxy(clientSide = "chemicraft.client.ClientProxy", serverSide = "chemicraft.CommonProxy")\r
64         public static CommonProxy proxy;\r
65 \r
66         /**\r
67          * ChemiCraftのCreativeTab\r
68          */\r
69         public static CreativeTabs creativeTab = new CreativeTabAtoms("ChemiCraft");\r
70 \r
71         /**\r
72          * ItemID\r
73          */\r
74         public static int atomsID;\r
75         public static int compoundsID;\r
76         public static int gasCollectingBottleID;\r
77 \r
78         /**\r
79          * BlockID\r
80          */\r
81         public static int scienceCraftingTableID;\r
82 \r
83         /**\r
84          * GUIID\r
85          */\r
86         public static int guiScienceCraftingTableID;\r
87 \r
88         /**\r
89          * Block型変数\r
90          */\r
91         public static Block blockScienceCraftingTable;\r
92 \r
93         /**\r
94          * Item型変数\r
95          */\r
96         public static Item itemAtoms;\r
97         public static Item itemCompounds;\r
98         public static Item itemGasCollectingBottle;\r
99 \r
100         /**\r
101          * このmodに必要な補助クラスのインスタンス\r
102          */\r
103         private static Auxiliary Auxiliary = new Auxiliary();\r
104         private static NameAuxiliary NameAuxiliary = Auxiliary.new NameAuxiliary();\r
105 \r
106         @Mod.PreInit\r
107         public void chemiPreLoadMethod(FMLPreInitializationEvent event)\r
108         {\r
109                 Configuration cfg = new Configuration(event.getSuggestedConfigurationFile());\r
110                 cfg.load();\r
111 \r
112                 Property scienceCraftingTableIDProp = cfg.getBlock("scienceCraftingTable", 200);\r
113                 Property atomsIDProp = cfg.getItem("atomsID", 25000);\r
114                 Property compoundsIDProp = cfg.getItem("compoundsID", 25001);\r
115                 Property gasCollectingBottleIDProp = cfg.getItem("gasCollectingBottleID", 25002);\r
116                 Property guiScienceCraftingTableIDProp = cfg.get("GUI", "GUIScienceCraftingTableID", 1000);\r
117 \r
118                 scienceCraftingTableID = scienceCraftingTableIDProp.getInt();\r
119                 atomsID = atomsIDProp.getInt();\r
120                 compoundsID = compoundsIDProp.getInt();\r
121                 gasCollectingBottleID = gasCollectingBottleIDProp.getInt();\r
122                 guiScienceCraftingTableID = guiScienceCraftingTableIDProp.getInt();\r
123 \r
124                 cfg.save();\r
125         }\r
126 \r
127         @Mod.PostInit\r
128         public void chemiPostLoadMethod(FMLPostInitializationEvent event)\r
129         {\r
130                 //API用の処理\r
131                 NameAuxiliary.addName(itemCompounds, ChemiCraftAPI.getCompoundsName().toArray());\r
132                 NameAuxiliary.addName(itemCompounds, "ja_JP", ChemiCraftAPI.getCompoundsLangName().toArray());\r
133 \r
134                 //Blockを追加します\r
135                 blockScienceCraftingTable = new BlockScienceCraftingTable(scienceCraftingTableID, Block.workbench.blockIndexInTexture, Material.ground).setHardness(2.0F).setResistance(0.0F).setStepSound(Block.soundStoneFootstep).setBlockName("ScienceCraftingTable");\r
136 \r
137                 //Itemを追加します\r
138                 itemAtoms = new ItemAtoms(atomsID).setItemName("atoms");\r
139                 itemCompounds = new ItemCompounds(compoundsID).setItemName("compounds");\r
140                 itemGasCollectingBottle = new ItemGasCollectingBottle(gasCollectingBottleID).setItemName("gasCollectingBottle");\r
141 \r
142                 //BlockをMinecraftに登録します\r
143                 GameRegistry.registerBlock(blockScienceCraftingTable);\r
144 \r
145                 //Blockの名前を設定します\r
146                 NameAuxiliary.addName(blockScienceCraftingTable, "ScienceCraftingTable");\r
147                 NameAuxiliary.addName(blockScienceCraftingTable, "ja_JP", "科学作業台");\r
148 \r
149                 //Itemの名前を設定します\r
150                 NameAuxiliary.addName(itemAtoms, atomsName);\r
151                 NameAuxiliary.addName(itemAtoms, "ja_JP", atomsNameJP);\r
152                 NameAuxiliary.addName(itemGasCollectingBottle, "GasCollectingBottle");\r
153                 NameAuxiliary.addName(itemGasCollectingBottle, "ja_JP", "集気瓶");\r
154 \r
155                 //化合物の名前を設定し追加します\r
156                 ChemiCraftAPI.addLangCompound("ja_JP", "Salt", "塩");\r
157 \r
158                 //TileEntityを追加します\r
159                 GameRegistry.registerTileEntity(TileEntityScienceCraftingTable.class, "TileEntityScienceCraftingTable");\r
160 \r
161                 //GUIを追加します\r
162                 NetworkRegistry.instance().registerGuiHandler(instance, proxy);\r
163 \r
164         }\r
165 \r
166 }