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.ItemStack;\r
7 import net.minecraft.src.Material;\r
8 import net.minecraftforge.common.Configuration;\r
9 import net.minecraftforge.common.Property;\r
10 import chemicraft.Auxiliary.NameAuxiliary;\r
11 import cpw.mods.fml.common.Mod;\r
12 import cpw.mods.fml.common.SidedProxy;\r
13 import cpw.mods.fml.common.event.FMLPostInitializationEvent;\r
14 import cpw.mods.fml.common.event.FMLPreInitializationEvent;\r
15 import cpw.mods.fml.common.network.NetworkMod;\r
16 import cpw.mods.fml.common.network.NetworkRegistry;\r
17 import cpw.mods.fml.common.registry.GameRegistry;\r
18 \r
19 /**\r
20  * ChemiCraft本体\r
21  *\r
22  * @author P.C.C.\r
23  *\r
24  */\r
25 @Mod(modid = "chemiCraft", name = "ChemiCraft", version = "beta")\r
26 // ID,名前,バージョン\r
27 @NetworkMod(clientSideRequired = true, serverSideRequired = false, versionBounds = "1.3.2", channels = "chemicraft", packetHandler = PacketHandler.class)\r
28 // クライアント、サーバー共に必要 1.3.2用\r
29 public class ChemiCraft {\r
30 \r
31         public final String[] atomsName = { "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon",\r
32                         "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium",\r
33                         "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttorium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium",\r
34                         "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium",\r
35                         "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum",\r
36                         "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium",\r
37                         "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium",\r
38                         "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Ununtrium", "Ununquadium", "Ununpentium", "Ununhexium", "Ununseptium", "Ununoctium" };\r
39 \r
40         public final String[] atomsNameJP = { "水素", "ヘリウム", "リチウム", "ベリウム", "ホウ素", "炭素", "窒素", "酸素", "フッ素", "ネオン", "ナトリウム", "マグネシウム", "アルミニウム", "ケイ素", "リン", "硫黄", "塩素", "アルゴン", "カリウム", "カルシウム", "スカンジウム",\r
41                         "チタン", "バナジウム", "クロム", "マンガン", "鉄", "コバルト", "ニッケル", "銅", "亜鉛", "ガリウム", "ゲルマニウム", "ヒ素", "セレン", "臭素", "クリプトン", "ルビジウム", "ストロンチウム", "イットリウム", "ジルコニウム", "ニオブ", "モリブデン", "テクネチウム", "ルテニウム",\r
42                         "ロジウム", "パラジウム", "銀", "カドミウム", "インジウム", "スズ", "アンチモン", "テルル", "ヨウ素", "キセノン", "セシウム", "バリウム", "ランタン", "セリウム", "プラセオジム", "ネオジム", "プロメチウム", "サマリウム", "ユウロビウム", "ガドリニウム", "テルビウム", "ジスプロニウム",\r
43                         "ホルミウム", "エルビウム", "ツリウム", "イッテルビウム", "ルテチウム", "ハフニウム", "タンタル", "タングステン", "レニウム", "オスミウム", "イリジウム", "白金", "金", "水銀", "タリウム", "鉛", "ビスマス", "ポロニウム", "アスタチン", "ラドン", "フランシウム", "ラジウム",\r
44                         "アクチニウム", "トリウム", "プロトアクチウム", "ウラン", "ネプツニウム", "プルトニウム", "アメリシウム", "キュリウム", "バークリウム", "カルホルニウム", "アインスタイニウム", "フェルミウム", "メンデレビウム", "ノーベリウム", "ローレンシウム", "ラサホージウム", "ドブニウム", "シーボーギウム",\r
45                         "ボーリウム", "ハッシウム", "マイトネリウム", "ダームスタチウム", "レントゲニウム", "コペルニシウム", "ウンウントリウム", "ウンウンクアジウム", "ウンウンペンチウム", "ウンウンヘキシウム", "ウンウンセプチウム", "ウンウンオクチウム" };\r
46 \r
47         /**\r
48          * このmodのインスタンス\r
49          */\r
50         @Mod.Instance("chemiCraft")\r
51         public static ChemiCraft instance;\r
52 \r
53         /**\r
54          * ChemiCraftのProxy\r
55          */\r
56         @SidedProxy(clientSide = "chemicraft.client.ClientProxy", serverSide = "chemicraft.CommonProxy")\r
57         public static CommonProxy proxy;\r
58 \r
59         /**\r
60          * ChemiCraftのCreativeTab\r
61          */\r
62         public CreativeTabs creativeTab = new CreativeTabAtoms("ChemiCraft");\r
63 \r
64         /**\r
65          * ItemID\r
66          */\r
67         public int atomsID;\r
68         public int compoundsID;\r
69         public int gasCollectingBottleID;\r
70 \r
71         /**\r
72          * BlockID\r
73          */\r
74         public int decompositionTableID;\r
75         public int chemicalConbinationTableID;\r
76         public int toolAndWeaponCraftingTableID;\r
77         public int materialCraftingTableID;\r
78 \r
79         /**\r
80          * GUIID\r
81          */\r
82         public int guiDecompositionTableID;\r
83         public int guiChemicalCombinationTableID;\r
84         public int guiToolAndWeaponCraftingTableID;\r
85         public int guiMaterialCraftingTableID;\r
86 \r
87         /**\r
88          * Block型変数\r
89          */\r
90         public Block blockDecompositionTable;\r
91         public Block blockChemicalCombinationTable;\r
92         public Block blockToolAndWeaponCraftingTable;\r
93         public Block blockMaterialCraftingTable;\r
94 \r
95         /**\r
96          * Item型変数\r
97          */\r
98         public Item itemAtoms;\r
99         public Item itemCompounds;\r
100         public Item itemGasCollectingBottle;\r
101 \r
102         /**\r
103          * このmodで使用するTextureのパス\r
104          */\r
105         public String itemAtomsTexture = "/chemicraft/items/Atoms.png";\r
106         public String itemCompoundsTexture = "/chemicraft/items/Compounds.png";\r
107         public String blockChemicalCraftingTableTexture = "/chemicraft/blocks/CCTable.png";\r
108         public String guiDecompositionTexture = "/chemicraft/guis/Decomposition.png";\r
109         public String guiChemicalCombinationTexture = "/chemicraft/guis/ChemicalCombination.png";\r
110         public String guiToolAndWeaponCraftingTexture = "/chemicraft/guis/ToolAndWeaponCrafting.png";\r
111         public String guiMaterialCraftingTexture = "/chemicraft/guis/MaterialCrafting.png";\r
112 \r
113         /**\r
114          * このmodに必要な補助クラスのインスタンス\r
115          */\r
116         private Auxiliary Auxiliary = new Auxiliary();\r
117         private NameAuxiliary NameAuxiliary = Auxiliary.new NameAuxiliary();\r
118 \r
119 \r
120         @Mod.PreInit\r
121         public void chemiPreLoadMethod(FMLPreInitializationEvent event) {\r
122                 Configuration cfg = new Configuration(event.getSuggestedConfigurationFile());\r
123                 cfg.load();\r
124 \r
125                 Property decompositionTableIDProp = cfg.getBlock("DecompositionTable", 2400);\r
126                 Property chemicalCombinationTableIDProp = cfg.getBlock("ChemicalCombinationID", 2401);\r
127                 Property toolAndWeaponCraftingTableIDProp = cfg.getBlock("ToolAndWeaponCraftingTableID", 2402);\r
128                 Property materialCraftingTableIDProp = cfg.getBlock("MaterialCraftingTableID", 2403);\r
129 \r
130                 Property atomsIDProp = cfg.getItem("AtomsID", 25000);\r
131                 Property compoundsIDProp = cfg.getItem("CompoundsID", 25001);\r
132                 Property gasCollectingBottleIDProp = cfg.getItem("gasCollectingBottleID", 25002);\r
133 \r
134                 Property guiDecompositionTableIDProp = cfg.get("GUI", "GUIChemicalCraftingTableID", 1000);\r
135                 Property guiChemicalCombinationTableIDProp = cfg.get("GUI", "GUIChemicalCombinationTableID", 1001);\r
136                 Property guiToolAndWeaponCraftingTableIDProp = cfg.get("GUI", "GUIToolAndWeaponCraftingTableID", 1002);\r
137                 Property guiMaterialCraftingTableIDProp = cfg.get("GUI", "GUIMaterialCraftingTableID", 1003);\r
138 \r
139 \r
140                 this.decompositionTableID = decompositionTableIDProp.getInt();\r
141                 this.chemicalConbinationTableID = chemicalCombinationTableIDProp.getInt();\r
142                 this.toolAndWeaponCraftingTableID = toolAndWeaponCraftingTableIDProp.getInt();\r
143                 this.materialCraftingTableID = materialCraftingTableIDProp.getInt();\r
144                 this.atomsID = atomsIDProp.getInt();\r
145                 this.compoundsID = compoundsIDProp.getInt();\r
146                 this.gasCollectingBottleID = gasCollectingBottleIDProp.getInt();\r
147                 this.guiDecompositionTableID = guiDecompositionTableIDProp.getInt();\r
148                 this.guiChemicalCombinationTableID = guiChemicalCombinationTableIDProp.getInt();\r
149                 this.guiToolAndWeaponCraftingTableID = guiToolAndWeaponCraftingTableIDProp.getInt();\r
150                 this.guiMaterialCraftingTableID = guiMaterialCraftingTableIDProp.getInt();\r
151 \r
152                 cfg.save();\r
153 \r
154                 // 描画関係の読み込み\r
155                 proxy.registerRenderInformation();\r
156         }\r
157 \r
158 \r
159         @Mod.PostInit\r
160         public void chemiPostLoadMethod(FMLPostInitializationEvent event) {\r
161                 // API用の処理\r
162                 this.NameAuxiliary.addName(itemCompounds, ChemiCraftAPI.getCompoundsName().toArray());\r
163                 this.NameAuxiliary.addName(itemCompounds, "ja_JP", ChemiCraftAPI.getCompoundsLangName().toArray());\r
164 \r
165                 // Blockを追加します\r
166                 this.blockDecompositionTable = new BlockDecompositionTable(this.decompositionTableID, 0, Material.ground).setHardness(2.0F).setResistance(0.0F).setStepSound(Block.soundStoneFootstep).setBlockName("DecompositionTable");\r
167                 this.blockChemicalCombinationTable = new BlockChemicalCombinationTable(this.chemicalConbinationTableID, 0, Material.ground).setHardness(2.0F).setResistance(0.0F).setStepSound(Block.soundStoneFootstep).setBlockName("ChemicalCombinationTable");\r
168                 this.blockToolAndWeaponCraftingTable = new BlockToolAndMaterialCraftingTable(this.toolAndWeaponCraftingTableID, 0, Material.ground).setHardness(2.0F).setResistance(0.0F).setStepSound(Block.soundStoneFootstep).setBlockName("ToolAndWeaponCraftingTable");\r
169                 this.blockMaterialCraftingTable = new BlockMaterialCraftingTable(materialCraftingTableID, 0, Material.ground).setHardness(2.0F).setResistance(0.0F).setStepSound(Block.soundStoneFootstep).setBlockName("MaterialCraftingTable");\r
170 \r
171 \r
172                 // Itemを追加します\r
173                 this.itemAtoms = new ItemAtoms(this.atomsID).setItemName("atoms");\r
174                 this.itemCompounds = new ItemCompounds(this.compoundsID).setItemName("compounds");\r
175                 this.itemGasCollectingBottle = new ItemGasCollectingBottle(this.gasCollectingBottleID).setItemName("gasCollectingBottle");\r
176 \r
177                 // BlockをMinecraftに登録します\r
178                 GameRegistry.registerBlock(this.blockDecompositionTable);\r
179                 GameRegistry.registerBlock(this.blockChemicalCombinationTable);\r
180                 GameRegistry.registerBlock(this.blockToolAndWeaponCraftingTable);\r
181                 GameRegistry.registerBlock(this.blockMaterialCraftingTable);\r
182 \r
183                 // Blockの名前を設定します\r
184                 this.NameAuxiliary.addName(this.blockDecompositionTable, "DecompositionTable");\r
185                 this.NameAuxiliary.addName(this.blockDecompositionTable, "ja_JP", "分解台");\r
186                 this.NameAuxiliary.addName(this.blockChemicalCombinationTable, "ChemicalCombinationTable");\r
187                 this.NameAuxiliary.addName(this.blockChemicalCombinationTable, "ja_JP", "化合台");\r
188                 this.NameAuxiliary.addName(blockToolAndWeaponCraftingTable, "ToolAndWeaponCraftingTable");\r
189                 this.NameAuxiliary.addName(blockToolAndWeaponCraftingTable, "ja_JP", "ツール&武器製作台");\r
190                 this.NameAuxiliary.addName(blockMaterialCraftingTable, "MaterialCraftingTable");\r
191                 this.NameAuxiliary.addName(blockMaterialCraftingTable, "ja_JP", "素材製作台");\r
192 \r
193 \r
194                 // Itemの名前を設定します\r
195                 this.NameAuxiliary.addName(this.itemAtoms, atomsName);\r
196                 this.NameAuxiliary.addName(this.itemAtoms, "ja_JP", atomsNameJP);\r
197                 this.NameAuxiliary.addName(this.itemGasCollectingBottle, "GasCollectingBottle");\r
198                 this.NameAuxiliary.addName(this.itemGasCollectingBottle, "ja_JP", "集気瓶");\r
199 \r
200                 // TileEntityを追加します\r
201                 GameRegistry.registerTileEntity(TileEntityDecompositionTable.class, "DecompositionTable");\r
202                 GameRegistry.registerTileEntity(TileEntityChemicalCombinationTable.class, "TileEntityChemicalCombinationTable");\r
203                 GameRegistry.registerTileEntity(TileEntityToolAndWeaponCraftingTable.class, "TileEntityToolAndWeaponCraftingTable");\r
204                 GameRegistry.registerTileEntity(TileEntityMaterialCraftingTable.class, "TileEntityMaterialCraftingTable");\r
205 \r
206                 // GUIを追加します\r
207                 NetworkRegistry.instance().registerGuiHandler(instance, proxy);\r
208 \r
209                 //分解レシピを追加します\r
210                 ChemiCraftAPI.instance.addDecompositionRecipe(new ItemStack(Block.dirt, 1, 0), new ItemStack[]{new ItemStack(Block.stone, 16, 0)});\r
211 \r
212                 //Textureをpreloadします\r
213                 proxy.registerTextures();\r
214         }\r
215 \r
216 }