OSDN Git Service

鉱石追加用クラス・API等を追加or更新
[chemicraft/chemicraft.git] / common / pcc / chemicraft / ChemiCraft.java
index b32dd60..0b99d76 100644 (file)
@@ -17,12 +17,12 @@ 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;
 import pcc.chemicraft.item.ItemGasCollectingBottle;
 import pcc.chemicraft.ore.BlockAtomsOre;
+import pcc.chemicraft.ore.ItemAtomsOre;
 import pcc.chemicraft.system.CommonProxy;
 import pcc.chemicraft.system.PacketHandler;
 import pcc.chemicraft.tileentity.TileEntityChemicalCombinationTable;
@@ -104,7 +104,7 @@ public class ChemiCraft {
        public int toolAndWeaponCraftingTableID;
        public int chemicalCraftingTableID;
 
-       public int atomsOreID;
+       public int[] atomsOreID = new int[1];
 
        /**
         * GUIID.
@@ -124,7 +124,7 @@ public class ChemiCraft {
        public Block blockToolAndWeaponCraftingTable;
        public Block blockChemicalCraftingTable;
 
-       public Block blockAtomsOre;
+       public Block[] blockAtomsOre = new Block[atomsOreID.length];
 
        /**
         * Item型変数.
@@ -141,7 +141,7 @@ public class ChemiCraft {
        public final String ITEM_COMPOUNDS_TEXTURE = "/pcc/chemicraft/items/Compounds.png";
        public final String ITEM_TEXTURE = "/pcc/chemicraft/items/items.png";
        public final String BLOCK_CHEMICAL_CRAFTING_TABLE_TEXTURE = "/pcc/chemicraft/blocks/cctable.png";
-       public final String BLOCK_ATOMS_ORE_TEXTURE = "/pcc/chemicraft/blocks/AtomsOres.png";
+       public final String BLOCK_ATOMS_ORE_TEXTURE = "/pcc/chemicraft/blocks/AtomsOre.png";
        public final String GUI_PYROLYSIS_TEXTURE = "/pcc/chemicraft/guis/Pyrolysis.png";
        public final String GUI_ELECTROLYSIS_TEXTURE = "/pcc/chemicraft/guis/Electrolysis.png";
        public final String GUI_CHEMICALCOMBINATION_TEXTURE = "/pcc/chemicraft/guis/ChemicalCombination.png";
@@ -169,7 +169,10 @@ public class ChemiCraft {
                Property toolAndWeaponCraftingTableIDProp = cfg.getBlock("ToolAndWeaponCraftingTableID", 2403);
                Property chemicalCraftingTableIDProp = cfg.getBlock("ChemicalCraftingTableID", 2404);
 
-               Property atomsOreIDProp = cfg.getBlock("AtomsOreID", 2500);
+               Property[] atomsOreIDProp = new Property[this.atomsOreID.length];
+               for (int i = 0; i < atomsOreIDProp.length; i++) {
+                       atomsOreIDProp[i] = cfg.getBlock("AtomsOreID:" + i, 2500 + i);
+               }
 
                Property atomsIDProp = cfg.getItem("AtomsID", 25000);
                Property compoundsIDProp = cfg.getItem("CompoundsID", 25001);
@@ -188,7 +191,9 @@ public class ChemiCraft {
                this.chemicalConbinationTableID = chemicalCombinationTableIDProp.getInt();
                this.toolAndWeaponCraftingTableID = toolAndWeaponCraftingTableIDProp.getInt();
                this.chemicalCraftingTableID = chemicalCraftingTableIDProp.getInt();
-               this.atomsOreID = atomsOreIDProp.getInt();
+               for (int i = 0; i < atomsOreID.length; i++) {
+                       this.atomsOreID[i] = atomsOreIDProp[i].getInt();
+               }
                this.atomsID = atomsIDProp.getInt();
                this.compoundsID = compoundsIDProp.getInt();
                this.gasCollectingBottleID = gasCollectingBottleIDProp.getInt();
@@ -245,6 +250,16 @@ public class ChemiCraft {
                                setStepSound(Block.soundStoneFootstep).
                                setBlockName("ChemicalCraftingTable");
 
+               for (int i = 0; i < blockAtomsOre.length; i++)
+               {
+                       this.blockAtomsOre[i] = new BlockAtomsOre(this.atomsOreID[i]).
+                                       setHardness(3.0F).
+                                       setResistance(0.0F).
+                                       setStepSound(Block.soundStoneFootstep).
+                                       setBlockName("AtomsOre" + i);
+                       GameRegistry.registerBlock(blockAtomsOre[i], ItemAtomsOre.class, "AtomsOre" + i);
+               }
+
                // Itemを追加します
                this.itemAtoms = new ItemAtoms(this.atomsID).setItemName("atoms");
                this.itemCompounds = new ItemCompounds(this.compoundsID).setItemName("compounds");
@@ -325,26 +340,16 @@ public class ChemiCraft {
                        Character.valueOf('A'), new ItemStack(this.itemAtoms, 1, 0),
                });
 
-               //鉱石の登録
-               for (int i = 0; i < api.getAtomsOreIDList().size(); i++) {
-                       this.blockAtomsOre = new BlockAtomsOre(api.getAtomsOreIDList().get(i)).
-                                       setHardness(3.0F).setResistance(5.0F).
-                                       setStepSound(Block.soundStoneFootstep).
-                                       setBlockName("AtomsOre" + "." + api.getAtomsOreIDList().get(i));
-                       GameRegistry.registerBlock(this.blockAtomsOre, "AtomsOre");
-               }
-
                //鉱石を追加します
-               api.addAtomsOre("Test", Block.blockDiamond.blockID, 0, 5, 5, 20); //テスト用
-
-               //鉱石の生成
-               for (int i = 0; i < api.getAtomsOreIDList().size(); i++) {
-                       GameRegistry.registerWorldGenerator(new WorldGenAtomsOre(api.getAtomsOreIDList().get(i), api.getAtomsOreMetaList().get(i), api.getAtomsOreSizeList().get(i), api.getAtomsOreFrequencyList().get(i), api.getAtomsOrePosYList().get(i)));
-               }
+               api.addAtomsOre("Petalite", this.atomsOreID[0], 0, 5, 5, 20); //ペタル石を追加
+               api.addAtomsOreLanguage("Petalite", "ペタル石", "ja_JP");
 
                //化合物を追加します
                api.addLangCompound("ja_JP", "ChlorousAcid", "亜塩素酸");
 
+               api.addLangCompound("ja_JP", "SodiumChloride", "塩化ナトリウム");
+               api.addLangCompound("ja_JP", "SodiumBicarbonate", "重曹");
+
                api.addLangCompound("ja_JP", "CarbonMonoxide", "一酸化炭素");
                api.addLangCompound("ja_JP", "CarbonDioxide", "二酸化炭素");
                api.addLangCompound("ja_JP", "Water", "水");
@@ -354,6 +359,7 @@ public class ChemiCraft {
                api.settingCompoundHandler("Water", new CompoundWater());
 
                //化合物のレシピを追加します
+               api.addChemicalCombinationRecipe(new String[]{"Na", "O", "H"}, new Integer[]{1, 1, 1}, new ItemStack(this.itemCompounds, 1, api.getCompound("SodiumChloride")));
                api.addChemicalCombinationRecipe(new String[]{"H", "O", "Cl"}, new Integer[]{1, 2, 1}, new ItemStack(this.itemCompounds, 1, api.getCompound("ChlorousAcid")));
 
                api.addChemicalCombinationRecipe(new String[]{"H", "O"}, new Integer[]{2, 1}, new ItemStack(this.itemCompounds, 1, api.getCompound("Water")));
@@ -391,6 +397,21 @@ public class ChemiCraft {
                for (int i = 0; i < api.getCompoundsLang().size(); i++) {
                        this.nameAuxiliary.addName(itemCompounds, api.getCompoundsLang().get(i), api.getCompoundsLangName().toArray());
                }
+
+               for (int i = 0; i < blockAtomsOre.length; i++)
+               {
+                       for (int j = 0; j < api.getAtomsOreNameListHash().sizeKeysList(); j++)
+                       {
+                               for (int k = 0; k < api.getAtomsOreNameListHash().sizeElementsList(api.getAtomsOreNameListHash().getKeyList(j)); k++)
+                               {
+                                       this.nameAuxiliary.addName(new ItemStack(blockAtomsOre[i], 0, j), api.getAtomsOreLangListHash().get(api.getAtomsOreNameListHash().getKeyList(j), k), api.getAtomsOreNameListHash().get(api.getAtomsOreNameListHash().getKeyList(j), k));
+                               }
+                       }
+               }
+               //鉱石の生成
+               for (int i = 0; i < api.getAtomsOreIDList().size(); i++) {
+                       GameRegistry.registerWorldGenerator(api.getAtomsOres().get(i));
+               }
        }
 
        private void debug(final FMLPostInitializationEvent event) {