OSDN Git Service

とりあえずコミット
[chemicraft/chemicraft.git] / common / pcc / chemicraft / ChemiCraft.java
index 32dac1c..7614b10 100644 (file)
@@ -17,6 +17,7 @@ import pcc.chemicraft.compounds.CompoundWater;
 import pcc.chemicraft.debug.CommandDeleteItem;
 import pcc.chemicraft.debug.CommandGenDebugRoom;
 import pcc.chemicraft.debug.CommandSetTile;
+import pcc.chemicraft.gen.WorldGenAtomsOre;
 import pcc.chemicraft.item.ItemAtoms;
 import pcc.chemicraft.item.ItemAtomsGrenade;
 import pcc.chemicraft.item.ItemCompounds;
@@ -41,7 +42,6 @@ import cpw.mods.fml.common.event.FMLServerStartingEvent;
 import cpw.mods.fml.common.network.NetworkMod;
 import cpw.mods.fml.common.network.NetworkRegistry;
 import cpw.mods.fml.common.registry.GameRegistry;
-
 /**
  * ChemiCraft本体
  * @author P.C.C.
@@ -78,7 +78,7 @@ public class ChemiCraft {
        /**
         * ChemiCraftのProxy.
         */
-       @SidedProxy(clientSide = "chemicraft.client.ClientProxy", serverSide = "chemicraft.system.CommonProxy")
+       @SidedProxy(clientSide = "pcc.chemicraft.client.ClientProxy", serverSide = "pcc.chemicraft.system.CommonProxy")
        public static CommonProxy proxy;
 
        /**
@@ -98,28 +98,28 @@ public class ChemiCraft {
         * BlockID.
         */
        public int pyrolysisTableID;
+       public int electrolysisTableID;
        public int chemicalConbinationTableID;
        public int toolAndWeaponCraftingTableID;
        public int chemicalCraftingTableID;
-       public int electrolysisTableID;
 
        /**
         * GUIID.
         */
        public int guiPyrolysisTableID;
+       public int guiElectrolysisTableID;
        public int guiChemicalCombinationTableID;
        public int guiToolAndWeaponCraftingTableID;
        public int guiChemicalCraftingTableID;
-       public int guiElectrolysisTableID;
 
        /**
         * Block型変数.
         */
        public Block blockPyrolysisTable;
+       public Block blockElectrolysisTable;
        public Block blockChemicalCombinationTable;
        public Block blockToolAndWeaponCraftingTable;
        public Block blockChemicalCraftingTable;
-       public Block blockElectrolysisTable;
 
        /**
         * Item型変数.
@@ -132,15 +132,15 @@ public class ChemiCraft {
        /**
         * このmodで使用するTextureのパス.
         */
-       public final String ITEM_ATOMS_TEXTURE = "/chemicraft/items/Atoms.png";
-       public final String ITEM_COMPOUNDS_TEXTURE = "/chemicraft/items/Compounds.png";
-       public final String ITEM_TEXTURE = "/chemicraft/items/items.png";
-       public final String BLOCK_CHEMICALCRAFTING_TABLE_TEXTURE = "/chemicraft/blocks/cctable.png";
-       public final String GUI_PYROLYSIS_TEXTURE = "/chemicraft/guis/Pyrolysis.png";
-       public final String GUI_ELECTROLYSIS_TEXTURE = "/chemicraft/guis/Electrolysis.png";
-       public final String GUI_CHEMICALCOMBINATION_TEXTURE = "/chemicraft/guis/ChemicalCombination.png";
-       public final String GUI_TOOLANDWEAPONCRAFTING_TEXTURE = "/chemicraft/guis/ToolAndWeaponCrafting.png";
-       public final String GUI_CHEMICALCRAFTING_TEXTURE = "/chemicraft/guis/MaterialCrafting.png";
+       public final String ITEMATOMSTEXTURE = "/pcc/chemicraft/items/Atoms.png";
+       public final String ITEMCOMPOUNDSTEXTURE = "/pcc/chemicraft/items/Compounds.png";
+       public final String ITEMTEXTURE = "/pcc/chemicraft/items/items.png";
+       public final String BLOCKCHEMICALCRAFTINGTABLETEXTURE = "/pcc/chemicraft/blocks/cctable.png";
+       public final String GUIPYROLYSISTEXTURE = "/pcc/chemicraft/guis/Pyrolysis.png";
+       public final String GUIELECTROLYSISTEXTURE = "/pcc/chemicraft/guis/Electrolysis.png";
+       public final String GUICHEMICALCOMBINATIONTEXTURE = "/pcc/chemicraft/guis/ChemicalCombination.png";
+       public final String GUITOOLANDWEAPONCRAFTINGTEXTURE = "/pcc/chemicraft/guis/ToolAndWeaponCrafting.png";
+       public final String GUICHEMICALCRAFTINGTEXTURE = "/pcc/chemicraft/guis/MaterialCrafting.png";
 
        /**
         * このmodに必要な補助クラスのインスタンス.
@@ -149,7 +149,7 @@ public class ChemiCraft {
        public NameAuxiliary nameAuxiliary = new NameAuxiliary();
        public ArrayAuxiliary arrayAuxiliary = new ArrayAuxiliary();
 
-       private ChemiCraftAPI api = ChemiCraftAPI.getInstance();
+       private ChemiCraftAPI api = ChemiCraftAPI.instance();
        private ChemiCraftData chemicalData = new ChemiCraftData();
 
        @Mod.PreInit
@@ -158,10 +158,10 @@ public class ChemiCraft {
                cfg.load();
 
                Property pyrolysisTableIDProp = cfg.getBlock("PyrolysisTable", 2400);
-               Property chemicalCombinationTableIDProp = cfg.getBlock("ChemicalCombinationID", 2401);
-               Property toolAndWeaponCraftingTableIDProp = cfg.getBlock("ToolAndWeaponCraftingTableID", 2402);
-               Property chemicalCraftingTableIDProp = cfg.getBlock("ChemicalCraftingTableID", 2403);
-               Property electrolysisTableIDProp = cfg.getBlock("ElectrolysisTableID", 2404);
+               Property electrolysisTableIDProp = cfg.getBlock("ElectrolysisTable", 2401);
+               Property chemicalCombinationTableIDProp = cfg.getBlock("ChemicalCombinationID", 2402);
+               Property toolAndWeaponCraftingTableIDProp = cfg.getBlock("ToolAndWeaponCraftingTableID", 2403);
+               Property chemicalCraftingTableIDProp = cfg.getBlock("ChemicalCraftingTableID", 2404);
 
                Property atomsIDProp = cfg.getItem("AtomsID", 25000);
                Property compoundsIDProp = cfg.getItem("CompoundsID", 25001);
@@ -169,26 +169,26 @@ public class ChemiCraft {
                Property atomGrenadeIDProp = cfg.getItem("AtomGrenadeID", 25003);
 
                Property guiPyrolysisTableIDProp = cfg.get("GUI", "GUIPyrolysisID", 1000);
-               Property guiChemicalCombinationTableIDProp = cfg.get("GUI", "GUIChemicalCombinationTableID", 1001);
-               Property guiToolAndWeaponCraftingTableIDProp = cfg.get("GUI", "GUIToolAndWeaponCraftingTableID", 1002);
-               Property guiChemicalCraftingTableIDProp = cfg.get("GUI", "GUIChemicalCraftingTableID", 1003);
-               Property guiElectrolysisTableIDProp = cfg.get("GUI", "GUIElectrolysisTableID", 1004);
+               Property guiElectrolysisTableIDProp = cfg.get("GUI", "GUIElectrolysisTableIDProp", 1001);
+               Property guiChemicalCombinationTableIDProp = cfg.get("GUI", "GUIChemicalCombinationTableID", 1002);
+               Property guiToolAndWeaponCraftingTableIDProp = cfg.get("GUI", "GUIToolAndWeaponCraftingTableID", 1003);
+               Property guiChemicalCraftingTableIDProp = cfg.get("GUI", "GUIChemicalCraftingTableID", 1004);
 
 
                this.pyrolysisTableID = pyrolysisTableIDProp.getInt();
+               this.electrolysisTableID = electrolysisTableIDProp.getInt();
                this.chemicalConbinationTableID = chemicalCombinationTableIDProp.getInt();
                this.toolAndWeaponCraftingTableID = toolAndWeaponCraftingTableIDProp.getInt();
                this.chemicalCraftingTableID = chemicalCraftingTableIDProp.getInt();
-               this.electrolysisTableID = electrolysisTableIDProp.getInt();
                this.atomsID = atomsIDProp.getInt();
                this.compoundsID = compoundsIDProp.getInt();
                this.gasCollectingBottleID = gasCollectingBottleIDProp.getInt();
                this.atomGrenadeID = atomGrenadeIDProp.getInt();
                this.guiPyrolysisTableID = guiPyrolysisTableIDProp.getInt();
+               this.guiElectrolysisTableID = guiElectrolysisTableIDProp.getInt();
                this.guiChemicalCombinationTableID = guiChemicalCombinationTableIDProp.getInt();
                this.guiToolAndWeaponCraftingTableID = guiToolAndWeaponCraftingTableIDProp.getInt();
                this.guiChemicalCraftingTableID = guiChemicalCraftingTableIDProp.getInt();
-               this.guiElectrolysisTableID = guiElectrolysisTableIDProp.getInt();
 
                cfg.save();
        }
@@ -316,20 +316,24 @@ public class ChemiCraft {
                        Character.valueOf('A'), new ItemStack(this.itemAtoms, 1, 0),
                });
 
-               // 化合物を追加します
-               api.addLangCompound("ja_JP", "CarbonMonoxide", "一酸化炭素");
-               api.addLangCompound("ja_JP", "CarbonDioxide", "二酸化炭素");
-               api.addLangCompound("ja_JP", "Water", "水");
+               //化合物を追加します
+               this.api.addLangCompound("ja_JP", "ChlorousAcid", "亜塩素酸");
+
+               this.api.addLangCompound("ja_JP", "CarbonMonoxide", "一酸化炭素");
+               this.api.addLangCompound("ja_JP", "CarbonDioxide", "二酸化炭素");
+               this.api.addLangCompound("ja_JP", "Water", "水");
 
 
                //化合物のHandlerを設定します
-               api.settingCompoundHandler("Water", new CompoundWater());
+               this.api.settingCompoundHandler("Water", new CompoundWater());
 
                //化合物のレシピを追加します
-               api.addChemicalCombinationRecipe(new String[]{"H", "O"}, new Integer[]{2, 1}, new ItemStack(this.itemCompounds, 1, api.getCompound("Water")));
+               this.api.addChemicalCombinationRecipe(new String[]{"H", "O", "Cl"}, new Integer[]{1, 2, 1}, new ItemStack(this.itemCompounds, 1, this.api.getCompound("ChlorousAcid")));
+
+               this.api.addChemicalCombinationRecipe(new String[]{"H", "O"}, new Integer[]{2, 1}, new ItemStack(this.itemCompounds, 1, this.api.getCompound("Water")));
 
                //手榴弾の追加
-               api.addMaterialRecipe(new ItemStack[] {
+               this.api.addMaterialRecipe(new ItemStack[] {
                                null,
                                new ItemStack(Block.stone),
                                null,
@@ -344,38 +348,47 @@ public class ChemiCraft {
                new NBTRecipeGrenade()
                                );
 
-               api.addDecompositionRecipe(new ItemStack(Item.potion, 1, 0),
+               this.api.addDecompositionRecipe(new ItemStack(Item.potion, 1, 0),
                                new int[] {ChemiCraftData.HYDROGEN, ChemiCraftData.OXYGEN},
                                new int[] {2, 1});
 
-               api.addDecompositionRecipe(new ItemStack(this.itemCompounds, 1, api.getCompound("Water")),
+               this.api.addDecompositionRecipe(new ItemStack(this.itemCompounds, 1, this.api.getCompound("Water")),
                                new int[] {ChemiCraftData.HYDROGEN, ChemiCraftData.OXYGEN},
                                new int[] {2, 1});
 
-               api.addDecompositionFuel(new ItemStack(Item.coal), 2000*8);
+               this.api.addDecompositionFuel(new ItemStack(Item.coal), 2000*8);
        }
 
        private void apiProcessing(final FMLPostInitializationEvent event) {
                // API用の処理
-               this.nameAuxiliary.addName(itemCompounds, api.getInstance().getCompoundsName().toArray());
-               for (int i = 0; i < api.getCompoundsLang().size(); i++) {
-                       this.nameAuxiliary.addName(itemCompounds, api.getCompoundsLang().get(i), api.getInstance().getCompoundsLangName().toArray());
+               this.nameAuxiliary.addName(itemCompounds, this.api.getCompoundsName().toArray());
+               for (int i = 0; i < this.api.getCompoundsLang().size(); i++) {
+                       this.nameAuxiliary.addName(itemCompounds, this.api.getCompoundsLang().get(i), this.api.getCompoundsLangName().toArray());
                }
+
+               //鉱石の生成
+               for (int i = 0; i < this.api.getAtomsOreIDList().size(); i++) {
+                       GameRegistry.registerWorldGenerator(new WorldGenAtomsOre(this.api.getAtomsOreIDList().get(i), this.api.getAtomsOreMetaList().get(i), this.api.getAtomsOreSizeList().get(i), this.api.getAtomsOreFrequencyList().get(i), this.api.getAtomsOrePosYList().get(i)));
+               }
+
        }
 
        private void debug(final FMLPostInitializationEvent event) {
                //DebugTickingの追加
                this.proxy.registerTickHandler();
-               api.addCompound("Debug");
+               this.api.addCompound("Debug");
                this.api.settingCompoundHandler("Debug", new CompoundDebug());
 
                /*
                 * TWDebug
                 */
-               api.addToolAndWeaponRecipe(new ItemStack[] {
+               this.api.addToolAndWeaponRecipe(new ItemStack[] {
                                new ItemStack(Block.stone, 1, 1)
                },
                new ItemStack(Block.dirt, 1, 0));
+
+               //鉱石を追加します
+               this.api.addAtomsOre(Block.blockDiamond.blockID, 0, 5, 5, 20);
        }
 
 }