OSDN Git Service

化合台完成
authormozipi <mozipi@users.sourceforge.jp>
Wed, 2 Jan 2013 10:31:42 +0000 (19:31 +0900)
committermozipi <mozipi@users.sourceforge.jp>
Wed, 2 Jan 2013 10:31:42 +0000 (19:31 +0900)
13 files changed:
common/chemicraft/ChemiCraft.java
common/chemicraft/ChemiCraftAPI.java
common/chemicraft/container/ContainerChemicalCombinationTable.java
common/chemicraft/container/ContainerChemicalCraftingTable.java
common/chemicraft/gui/GuiChemicalCombinationTable.java
common/chemicraft/item/ItemAtomGrenade.java
common/chemicraft/item/ItemAtoms.java
common/chemicraft/item/ItemCompounds.java
common/chemicraft/item/ItemGasCollectingBottle.java
common/chemicraft/system/ChemiCraftCraftingManager.java
common/chemicraft/tileentity/TileEntityChemicalCombinationTable.java
common/chemicraft/util/CompaeatorFormulaPart.java [new file with mode: 0644]
common/chemicraft/util/FormulaPart.java [new file with mode: 0644]

index d054218..faef936 100644 (file)
@@ -40,7 +40,6 @@ import cpw.mods.fml.common.registry.GameRegistry;
 \r
 /**\r
  * ChemiCraft本体\r
- *\r
  * @author P.C.C.\r
  *\r
  */\r
@@ -50,21 +49,23 @@ import cpw.mods.fml.common.registry.GameRegistry;
 // クライアント、サーバー共に必要 1.3.2用\r
 public class ChemiCraft {\r
 \r
-       public final String[] atomsName = { "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon",\r
-                       "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium",\r
-                       "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttorium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium",\r
-                       "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium",\r
-                       "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum",\r
-                       "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium",\r
-                       "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium",\r
-                       "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Ununtrium", "Ununquadium", "Ununpentium", "Ununhexium", "Ununseptium", "Ununoctium" };\r
-\r
-       public final String[] atomsNameJP = { "水素", "ヘリウム", "リチウム", "ベリウム", "ホウ素", "炭素", "窒素", "酸素", "フッ素", "ネオン", "ナトリウム", "マグネシウム", "アルミニウム", "ケイ素", "リン", "硫黄", "塩素", "アルゴン", "カリウム", "カルシウム", "スカンジウム",\r
-                       "チタン", "バナジウム", "クロム", "マンガン", "鉄", "コバルト", "ニッケル", "銅", "亜鉛", "ガリウム", "ゲルマニウム", "ヒ素", "セレン", "臭素", "クリプトン", "ルビジウム", "ストロンチウム", "イットリウム", "ジルコニウム", "ニオブ", "モリブデン", "テクネチウム", "ルテニウム",\r
-                       "ロジウム", "パラジウム", "銀", "カドミウム", "インジウム", "スズ", "アンチモン", "テルル", "ヨウ素", "キセノン", "セシウム", "バリウム", "ランタン", "セリウム", "プラセオジム", "ネオジム", "プロメチウム", "サマリウム", "ユウロビウム", "ガドリニウム", "テルビウム", "ジスプロニウム",\r
-                       "ホルミウム", "エルビウム", "ツリウム", "イッテルビウム", "ルテチウム", "ハフニウム", "タンタル", "タングステン", "レニウム", "オスミウム", "イリジウム", "白金", "金", "水銀", "タリウム", "鉛", "ビスマス", "ポロニウム", "アスタチン", "ラドン", "フランシウム", "ラジウム",\r
-                       "アクチニウム", "トリウム", "プロトアクチウム", "ウラン", "ネプツニウム", "プルトニウム", "アメリシウム", "キュリウム", "バークリウム", "カルホルニウム", "アインスタイニウム", "フェルミウム", "メンデレビウム", "ノーベリウム", "ローレンシウム", "ラサホージウム", "ドブニウム", "シーボーギウム",\r
-                       "ボーリウム", "ハッシウム", "マイトネリウム", "ダームスタチウム", "レントゲニウム", "コペルニシウム", "ウンウントリウム", "ウンウンクアジウム", "ウンウンペンチウム", "ウンウンヘキシウム", "ウンウンセプチウム", "ウンウンオクチウム" };\r
+       public static final String[] ATOMSNAME = {\r
+               "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon",\r
+               "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium",\r
+               "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttorium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium",\r
+               "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium",\r
+               "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum",\r
+               "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium",\r
+               "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium",\r
+               "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Ununtrium", "Ununquadium", "Ununpentium", "Ununhexium", "Ununseptium", "Ununoctium" };\r
+\r
+       public static final String[] ATOMSNAMEJP = {\r
+               "水素", "ヘリウム", "リチウム", "ベリウム", "ホウ素", "炭素", "窒素", "酸素", "フッ素", "ネオン", "ナトリウム", "マグネシウム", "アルミニウム", "ケイ素", "リン", "硫黄", "塩素", "アルゴン", "カリウム", "カルシウム", "スカンジウム",\r
+               "チタン", "バナジウム", "クロム", "マンガン", "鉄", "コバルト", "ニッケル", "銅", "亜鉛", "ガリウム", "ゲルマニウム", "ヒ素", "セレン", "臭素", "クリプトン", "ルビジウム", "ストロンチウム", "イットリウム", "ジルコニウム", "ニオブ", "モリブデン", "テクネチウム", "ルテニウム",\r
+               "ロジウム", "パラジウム", "銀", "カドミウム", "インジウム", "スズ", "アンチモン", "テルル", "ヨウ素", "キセノン", "セシウム", "バリウム", "ランタン", "セリウム", "プラセオジム", "ネオジム", "プロメチウム", "サマリウム", "ユウロビウム", "ガドリニウム", "テルビウム", "ジスプロニウム",\r
+               "ホルミウム", "エルビウム", "ツリウム", "イッテルビウム", "ルテチウム", "ハフニウム", "タンタル", "タングステン", "レニウム", "オスミウム", "イリジウム", "白金", "金", "水銀", "タリウム", "鉛", "ビスマス", "ポロニウム", "アスタチン", "ラドン", "フランシウム", "ラジウム",\r
+               "アクチニウム", "トリウム", "プロトアクチウム", "ウラン", "ネプツニウム", "プルトニウム", "アメリシウム", "キュリウム", "バークリウム", "カルホルニウム", "アインスタイニウム", "フェルミウム", "メンデレビウム", "ノーベリウム", "ローレンシウム", "ラサホージウム", "ドブニウム", "シーボーギウム",\r
+               "ボーリウム", "ハッシウム", "マイトネリウム", "ダームスタチウム", "レントゲニウム", "コペルニシウム", "ウンウントリウム", "ウンウンクアジウム", "ウンウンペンチウム", "ウンウンヘキシウム", "ウンウンセプチウム", "ウンウンオクチウム" };\r
 \r
        /**\r
         * このmodのインスタンス\r
@@ -73,18 +74,18 @@ public class ChemiCraft {
        public static ChemiCraft instance;\r
 \r
        /**\r
-        * ChemiCraftのProxy\r
+        * ChemiCraftのProxy.\r
         */\r
        @SidedProxy(clientSide = "chemicraft.client.ClientProxy", serverSide = "chemicraft.system.CommonProxy")\r
        public static CommonProxy proxy;\r
 \r
        /**\r
-        * ChemiCraftのCreativeTab\r
+        * ChemiCraftのCreativeTab.\r
         */\r
        public static final CreativeTabs creativeTab = new CreativeTabAtoms("ChemiCraft");\r
 \r
        /**\r
-        * ItemID\r
+        * ItemID.\r
         */\r
        public int atomsID;\r
        public int compoundsID;\r
@@ -92,7 +93,7 @@ public class ChemiCraft {
        public int atomGrenadeID;\r
 \r
        /**\r
-        * BlockID\r
+        * BlockID.\r
         */\r
        public int decompositionTableID;\r
        public int chemicalConbinationTableID;\r
@@ -100,7 +101,7 @@ public class ChemiCraft {
        public int chemicalCraftingTableID;\r
 \r
        /**\r
-        * GUIID\r
+        * GUIID.\r
         */\r
        public int guiDecompositionTableID;\r
        public int guiChemicalCombinationTableID;\r
@@ -108,7 +109,7 @@ public class ChemiCraft {
        public int guiChemicalCraftingTableID;\r
 \r
        /**\r
-        * Block型変数\r
+        * Block型変数.\r
         */\r
        public Block blockDecompositionTable;\r
        public Block blockChemicalCombinationTable;\r
@@ -116,7 +117,7 @@ public class ChemiCraft {
        public Block blockChemicalCraftingTable;\r
 \r
        /**\r
-        * Item型変数\r
+        * Item型変数.\r
         */\r
        public Item itemAtoms;\r
        public Item itemCompounds;\r
@@ -124,7 +125,7 @@ public class ChemiCraft {
        public Item itemAtomGrenade;\r
 \r
        /**\r
-        * このmodで使用するTextureのパス\r
+        * このmodで使用するTextureのパス.\r
         */\r
        public String itemAtomsTexture = "/chemicraft/items/Atoms.png";\r
        public String itemCompoundsTexture = "/chemicraft/items/Compounds.png";\r
@@ -136,23 +137,23 @@ public class ChemiCraft {
        public String guiChemicalCraftingTexture = "/chemicraft/guis/MaterialCrafting.png";\r
 \r
        /**\r
-        * このmodに必要な補助クラスのインスタンス\r
+        * このmodに必要な補助クラスのインスタンス.\r
         */\r
        public Auxiliary auxiliary = new Auxiliary();\r
        public NameAuxiliary nameAuxiliary = new NameAuxiliary();\r
        public ArrayAuxiliary arrayAuxiliary = new ArrayAuxiliary();\r
 \r
-       private ChemiCraftAPI api = ChemiCraftAPI.instance;\r
+       private ChemiCraftAPI api = ChemiCraftAPI.getInstance();\r
 \r
        @Mod.PreInit\r
-       public void chemiPreLoadMethod(FMLPreInitializationEvent event) {\r
+       public void chemiPreLoadMethod(final FMLPreInitializationEvent event) {\r
                Configuration cfg = new Configuration(event.getSuggestedConfigurationFile());\r
                cfg.load();\r
 \r
                Property decompositionTableIDProp = cfg.getBlock("DecompositionTable", 2400);\r
                Property chemicalCombinationTableIDProp = cfg.getBlock("ChemicalCombinationID", 2401);\r
                Property toolAndWeaponCraftingTableIDProp = cfg.getBlock("ToolAndWeaponCraftingTableID", 2402);\r
-               Property ChemicalCraftingTableIDProp = cfg.getBlock("ChemicalCraftingTableID", 2403);\r
+               Property chemicalCraftingTableIDProp = cfg.getBlock("ChemicalCraftingTableID", 2403);\r
 \r
                Property atomsIDProp = cfg.getItem("AtomsID", 25000);\r
                Property compoundsIDProp = cfg.getItem("CompoundsID", 25001);\r
@@ -168,7 +169,7 @@ public class ChemiCraft {
                this.decompositionTableID = decompositionTableIDProp.getInt();\r
                this.chemicalConbinationTableID = chemicalCombinationTableIDProp.getInt();\r
                this.toolAndWeaponCraftingTableID = toolAndWeaponCraftingTableIDProp.getInt();\r
-               this.chemicalCraftingTableID = ChemicalCraftingTableIDProp.getInt();\r
+               this.chemicalCraftingTableID = chemicalCraftingTableIDProp.getInt();\r
                this.atomsID = atomsIDProp.getInt();\r
                this.compoundsID = compoundsIDProp.getInt();\r
                this.gasCollectingBottleID = gasCollectingBottleIDProp.getInt();\r
@@ -185,25 +186,42 @@ public class ChemiCraft {
        }\r
 \r
        @Mod.ServerStarting\r
-       public void serverStarting(FMLServerStartingEvent event){\r
+       public void serverStarting(final FMLServerStartingEvent event) {\r
                event.registerServerCommand(new CommandSetTile());\r
                event.registerServerCommand(new CommandDeleteItem());\r
                event.registerServerCommand(new CommandGenDebugRoom());\r
        }\r
 \r
        @Mod.PostInit\r
-       public void chemiPostLoadMethod(FMLPostInitializationEvent event) {\r
+       public void chemiPostLoadMethod(final FMLPostInitializationEvent event) {\r
                this.settingProcessing(event);\r
                this.apiProcessing(event);\r
+               this.debug(event);\r
        }\r
 \r
-       private void settingProcessing(FMLPostInitializationEvent event){\r
+       private void settingProcessing(final FMLPostInitializationEvent event) {\r
 \r
                // Blockを追加します\r
-               this.blockDecompositionTable = new BlockDecompositionTable(this.decompositionTableID, 0, Material.ground).setHardness(2.0F).setResistance(0.0F).setStepSound(Block.soundStoneFootstep).setBlockName("DecompositionTable");\r
-               this.blockChemicalCombinationTable = new BlockChemicalCombinationTable(this.chemicalConbinationTableID, 0, Material.ground).setHardness(2.0F).setResistance(0.0F).setStepSound(Block.soundStoneFootstep).setBlockName("ChemicalCombinationTable");\r
-               this.blockToolAndWeaponCraftingTable = new BlockToolAndWeaponCraftingTable(this.toolAndWeaponCraftingTableID, 0, Material.ground).setHardness(2.0F).setResistance(0.0F).setStepSound(Block.soundStoneFootstep).setBlockName("ToolAndWeaponCraftingTable");\r
-               this.blockChemicalCraftingTable = new BlockChemicalCraftingTable(chemicalCraftingTableID, 0, Material.ground).setHardness(2.0F).setResistance(0.0F).setStepSound(Block.soundStoneFootstep).setBlockName("ChemicalCraftingTable");\r
+               this.blockDecompositionTable = new BlockDecompositionTable(this.decompositionTableID, 0, Material.ground).\r
+                               setHardness(2.0F).\r
+                               setResistance(0.0F).\r
+                               setStepSound(Block.soundStoneFootstep).\r
+                               setBlockName("DecompositionTable");\r
+               this.blockChemicalCombinationTable = new BlockChemicalCombinationTable(this.chemicalConbinationTableID, 0, Material.ground).\r
+                               setHardness(2.0F).\r
+                               setResistance(0.0F).\r
+                               setStepSound(Block.soundStoneFootstep).\r
+                               setBlockName("ChemicalCombinationTable");\r
+               this.blockToolAndWeaponCraftingTable = new BlockToolAndWeaponCraftingTable(this.toolAndWeaponCraftingTableID, 0, Material.ground).\r
+                               setHardness(2.0F).\r
+                               setResistance(0.0F).\r
+                               setStepSound(Block.soundStoneFootstep).\r
+                               setBlockName("ToolAndWeaponCraftingTable");\r
+               this.blockChemicalCraftingTable = new BlockChemicalCraftingTable(chemicalCraftingTableID, 0, Material.ground).\r
+                               setHardness(2.0F).\r
+                               setResistance(0.0F).\r
+                               setStepSound(Block.soundStoneFootstep).\r
+                               setBlockName("ChemicalCraftingTable");\r
 \r
 \r
                // Itemを追加します\r
@@ -230,8 +248,8 @@ public class ChemiCraft {
 \r
 \r
                // Itemの名前を設定します\r
-               this.nameAuxiliary.addName(this.itemAtoms, atomsName);\r
-               this.nameAuxiliary.addName(this.itemAtoms, "ja_JP", atomsNameJP);\r
+               this.nameAuxiliary.addName(this.itemAtoms, ATOMSNAME);\r
+               this.nameAuxiliary.addName(this.itemAtoms, "ja_JP", ATOMSNAMEJP);\r
                this.nameAuxiliary.addName(this.itemGasCollectingBottle, "GasCollectingBottle");\r
                this.nameAuxiliary.addName(this.itemGasCollectingBottle, "ja_JP", "集気瓶");\r
                this.nameAuxiliary.addName(this.itemAtomGrenade, "AtomGrenade");\r
@@ -284,276 +302,296 @@ public class ChemiCraft {
                });\r
 \r
                //\r
-               ChemiCraftAPI.instance.addDecompositionRecipe(new ItemStack(Block.dirt), new ItemStack[]{new ItemStack(Block.stone)});\r
+               ChemiCraftAPI.getInstance().addDecompositionRecipe(new ItemStack(Block.dirt), new ItemStack[]{new ItemStack(Block.stone)});\r
 \r
                // 化合物を追加します\r
-               ChemiCraftAPI.instance.addLangCompound("ja_JP", "CarbonDioxide", "二酸化炭素");\r
-\r
-               // 化合物のレシピを追加します\r
-               ChemiCraftAPI.instance.addChemicalCombinationRecipe(new ItemStack[]{new ItemStack(this.itemAtoms, 1, CARBON), new ItemStack(this.itemAtoms, 1, OXYGEN) }, new ItemStack(this.itemCompounds, 1, api.getDamageByName("CarbonDioxide")));\r
+               ChemiCraftAPI.getInstance().addLangCompound("ja_JP", "CarbonDioxide", "二酸化炭素");\r
 \r
                //手榴弾の追加\r
-               ChemiCraftAPI.instance.addMaterialRecipe(new ItemStack[]{null, new ItemStack(Block.stone), null, new ItemStack(Block.stone), new ItemStack(Item.gunpowder), new ItemStack(Block.stone), null, new ItemStack(Block.stone), null}, new ItemStack(this.itemAtomGrenade, 16, 0), new NBTRecipeGrenade());\r
+               ChemiCraftAPI.getInstance().addMaterialRecipe(\r
+                               new ItemStack[]{\r
+                                               null,\r
+                                               new ItemStack(Block.stone),\r
+                                               null,\r
+                                               new ItemStack(Block.stone),\r
+                                               new ItemStack(Item.gunpowder),\r
+                                               new ItemStack(Block.stone),\r
+                                               null,\r
+                                               new ItemStack(Block.stone),\r
+                                               null\r
+                               },\r
+                               new ItemStack(this.itemAtomGrenade, 16, 0),\r
+                               new NBTRecipeGrenade()\r
+                               );\r
 \r
        }\r
 \r
-       private void apiProcessing(FMLPostInitializationEvent event){\r
+       private void apiProcessing(final FMLPostInitializationEvent event) {\r
                // API用の処理\r
-               this.nameAuxiliary.addName(itemCompounds, ChemiCraftAPI.instance.getCompoundsName().toArray());\r
-               this.nameAuxiliary.addName(itemCompounds, "ja_JP", ChemiCraftAPI.instance.getCompoundsLangName().toArray());\r
+               this.nameAuxiliary.addName(itemCompounds, ChemiCraftAPI.getInstance().getCompoundsName().toArray());\r
+               this.nameAuxiliary.addName(itemCompounds, "ja_JP", ChemiCraftAPI.getInstance().getCompoundsLangName().toArray());\r
+       }\r
+\r
+       private void debug(final FMLPostInitializationEvent event) {\r
+               //デバッグ処理\r
+               api.addChemicalCombinationRecipe(\r
+                               new String[]{HYDROGEN_SIGN, OXYGEN_SIGN},\r
+                               new Integer[]{2, 1},\r
+                               new ItemStack(Block.dirt)\r
+                               );\r
        }\r
 \r
-       public final static int HYDROGEN = 0;\r
-       public final static int HELIUM = 1;\r
-       public final static int LITHIUM = 2;\r
-       public final static int BERYLLIUM = 3;\r
-       public final static int BORON = 4;\r
-       public final static int CARBON = 5;\r
-       public final static int NITROGEN = 6;\r
-       public final static int OXYGEN = 7;\r
-       public final static int FLUORINE = 8;\r
-       public final static int NEON = 9;\r
-       public final static int SODIUM = 10;\r
-       public final static int MAGNESIUM = 11;\r
-       public final static int ALMINIUM = 12;\r
-       public final static int SILICON = 13;\r
-       public final static int PHOSPHORUS = 14;\r
-       public final static int SULFUR = 15;\r
-       public final static int CHLORINE = 16;\r
-       public final static int ARGON = 17;\r
-       public final static int POTASSIUM = 18;\r
-       public final static int CALCIUM = 19;\r
-       public final static int SCANDIUM = 20;\r
-       public final static int TITANIUM = 21;\r
-       public final static int VANADIUM = 22;\r
-       public final static int CHROMIUM = 23;\r
-       public final static int MANGANESE = 24;\r
-       public final static int IRON = 25;\r
-       public final static int COBALT = 26;\r
-       public final static int NICKEL = 27;\r
-       public final static int COPPER = 28;\r
-       public final static int ZINC = 29;\r
-       public final static int GALLIUM = 30;\r
-       public final static int GERMANIUM = 31;\r
-       public final static int ARSENIC = 32;\r
-       public final static int SELENIUM = 33;\r
-       public final static int BROMINE = 34;\r
-       public final static int KRYPTON = 35;\r
-       public final static int RUBIDIUM = 36;\r
-       public final static int STRONTIUM = 37;\r
-       public final static int YTTORIUM = 38;\r
-       public final static int ZIRCONIUM = 39;\r
-       public final static int NIOBIUM = 40;\r
-       public final static int MOLYBDENUM = 41;\r
-       public final static int TECHNETIUM = 42;\r
-       public final static int RUTHENIUM = 43;\r
-       public final static int RHODIUM = 44;\r
-       public final static int PALLADIUM = 45;\r
-       public final static int SILVER = 46;\r
-       public final static int CADMIUM = 47;\r
-       public final static int INDIUM = 48;\r
-       public final static int TIN = 49;\r
-       public final static int ANTIMONY = 50;\r
-       public final static int TELLURIUM = 51;\r
-       public final static int IODINE = 52;\r
-       public final static int XENON = 53;\r
-       public final static int CAESIUM = 54;\r
-       public final static int BARIUM = 55;\r
-       public final static int LANTHANUM = 56;\r
-       public final static int CERIUM = 57;\r
-       public final static int PRASEODYMIUM = 58;\r
-       public final static int NEODYMIUM = 59;\r
-       public final static int PROMETHIUM = 60;\r
-       public final static int SAMARIUM = 61;\r
-       public final static int EUROPIUM = 62;\r
-       public final static int GADOLINIUM = 63;\r
-       public final static int TERBIUM = 64;\r
-       public final static int DYSPROSIUM = 65;\r
-       public final static int HOLMIUM = 66;\r
-       public final static int ERBIUM = 67;\r
-       public final static int THULIUM = 68;\r
-       public final static int YTTERBIUM = 69;\r
-       public final static int LUTETIUM = 70;\r
-       public final static int HAFNIUM = 71;\r
-       public final static int TANTALUM = 72;\r
-       public final static int TUNGSTEN = 73;\r
-       public final static int RHENIUM = 74;\r
-       public final static int OSMIUM = 75;\r
-       public final static int IRIDIUM = 76;\r
-       public final static int PLATINUM = 77;\r
-       public final static int GOLD = 78;\r
-       public final static int MERCURY = 79;\r
-       public final static int THALLIUM = 80;\r
-       public final static int LEAD = 81;\r
-       public final static int BISMUTH = 82;\r
-       public final static int POLONIUM = 83;\r
-       public final static int ASTATINE = 84;\r
-       public final static int RADON = 85;\r
-       public final static int FRANCIUM = 86;\r
-       public final static int RADIUM = 87;\r
-       public final static int ACTINIUM = 88;\r
-       public final static int THORIUM = 89;\r
-       public final static int PROTACTINIUM = 90;\r
-       public final static int URANIUM = 91;\r
-       public final static int NEPTUNIUM = 92;\r
-       public final static int PLUTONIUM = 93;\r
-       public final static int AMERICIUM = 94;\r
-       public final static int CURIUM = 95;\r
-       public final static int BERKELIUM = 96;\r
-       public final static int CALIFORNIUM = 97;\r
-       public final static int EINSTEINIUM = 98;\r
-       public final static int FERMIUM = 99;\r
-       public final static int MENDILEVIUM = 100;\r
-       public final static int NOBELIUM = 101;\r
-       public final static int LAWRENCIUM = 102;\r
-       public final static int RUTHERFORDIUM = 103;\r
-       public final static int DUBNIUM = 104;\r
-       public final static int SEABORGIUM = 105;\r
-       public final static int BOHRIUM = 106;\r
-       public final static int HASSIUM = 107;\r
-       public final static int MEITNERIUM = 108;\r
-       public final static int DARMSTADTIUM = 109;\r
-       public final static int ROENTGENIUM = 110;\r
-       public final static int COPERNICIUM = 111;\r
-       public final static int UNUNTRIUM = 112;\r
-       public final static int UNUNQUADIUM = 113;\r
-       public final static int UNUNPENTIUM = 114;\r
-       public final static int UNUNHEXIUM = 115;\r
-       public final static int UNUNSEPTIUM = 116;\r
-       public final static int UNUNOCTIUM = 117;\r
-\r
-       public final static String HYDROGEN_ = "H";\r
-       public final static String HELIUM_ = "He";\r
-       public final static String LITHIUM_ = "Li";\r
-       public final static String BERYLLIUM_ = "Be";\r
-       public final static String BORON_ = "B";\r
-       public final static String CARBON_ = "C";\r
-       public final static String NITROGEN_ = "N";\r
-       public final static String OXYGEN_ = "O";\r
-       public final static String FLUORINE_ = "F";\r
-       public final static String NEON_ = "Ne";\r
-       public final static String SODIUM_ = "Na";\r
-       public final static String MAGNESIUM_ = "Mg";\r
-       public final static String ALMINIUM_ = "Al";\r
-       public final static String SILICON_ = "Si";\r
-       public final static String PHOSPHORUS_ = "P";\r
-       public final static String SULFUR_ = "S";\r
-       public final static String CHLORINE_ = "Cl";\r
-       public final static String ARGON_ = "Ar";\r
-       public final static String POTASSIUM_ = "K";\r
-       public final static String CALCIUM_ = "Ca";\r
-       public final static String SCANDIUM_ = "Sc";\r
-       public final static String TITANIUM_ = "Ti";\r
-       public final static String VANADIUM_ = "V";\r
-       public final static String CHROMIUM_ = "Cr";\r
-       public final static String MANGANESE_ = "Mn";\r
-       public final static String IRON_ = "Fe";\r
-       public final static String COBALT_ = "Co";\r
-       public final static String NICKEL_ = "Ni";\r
-       public final static String COPPER_ = "Cu";\r
-       public final static String ZINC_ = "Zn";\r
-       public final static String GALLIUM_ = "Ga";\r
-       public final static String GERMANIUM_ = "Ge";\r
-       public final static String ARSENIC_ = "As";\r
-       public final static String SELENIUM_ = "Se";\r
-       public final static String BROMINE_ = "Br";\r
-       public final static String KRYPTON_ = "Kr";\r
-       public final static String RUBIDIUM_ = "Rb";\r
-       public final static String STRONTIUM_ = "Sr";\r
-       public final static String YTTORIUM_ = "Y";\r
-       public final static String ZIRCONIUM_ = "Zr";\r
-       public final static String NIOBIUM_ = "Nb";\r
-       public final static String MOLYBDENUM_ = "Mo";\r
-       public final static String TECHNETIUM_ = "Tc";\r
-       public final static String RUTHENIUM_ = "Ru";\r
-       public final static String RHODIUM_ = "Rh";\r
-       public final static String PALLADIUM_ = "Pd";\r
-       public final static String SILVER_ = "Ag";\r
-       public final static String CADMIUM_ = "Cd";\r
-       public final static String INDIUM_ = "In";\r
-       public final static String TIN_ = "Sn";\r
-       public final static String ANTIMONY_ = "Sb";\r
-       public final static String TELLURIUM_ = "Te";\r
-       public final static String IODINE_ = "I";\r
-       public final static String XENON_ = "Xe";\r
-       public final static String CAESIUM_ = "Cs";\r
-       public final static String BARIUM_ = "Ba";\r
-       public final static String LANTHANUM_ = "La";\r
-       public final static String CERIUM_ = "Ce";\r
-       public final static String PRASEODYMIUM_ = "Pr";\r
-       public final static String NEODYMIUM_ = "Nd";\r
-       public final static String PROMETHIUM_ = "Pm";\r
-       public final static String SAMARIUM_ = "Sm";\r
-       public final static String EUROPIUM_ = "Eu";\r
-       public final static String GADOLINIUM_ = "Gd";\r
-       public final static String TERBIUM_ = "Tb";\r
-       public final static String DYSPROSIUM_ = "Dy";\r
-       public final static String HOLMIUM_ = "Ho";\r
-       public final static String ERBIUM_ = "Er";\r
-       public final static String THULIUM_ = "Tm";\r
-       public final static String YTTERBIUM_ = "Yb";\r
-       public final static String LUTETIUM_ = "Lu";\r
-       public final static String HAFNIUM_ = "Hf";\r
-       public final static String TANTALUM_ = "Ta";\r
-       public final static String TUNGSTEN_ = "W";\r
-       public final static String RHENIUM_ = "Re";\r
-       public final static String OSMIUM_ = "Os";\r
-       public final static String IRIDIUM_ = "Ir";\r
-       public final static String PLATINUM_ = "Pt";\r
-       public final static String GOLD_ = "Au";\r
-       public final static String MERCURY_ = "Hg";\r
-       public final static String THALLIUM_ = "Tl";\r
-       public final static String LEAD_ = "Pb";\r
-       public final static String BISMUTH_ = "Bi";\r
-       public final static String POLONIUM_ = "Po";\r
-       public final static String ASTATINE_ = "At";\r
-       public final static String RADON_ = "Rn";\r
-       public final static String FRANCIUM_ = "Fr";\r
-       public final static String RADIUM_ = "Ra";\r
-       public final static String ACTINIUM_ = "Ac";\r
-       public final static String THORIUM_ = "Th";\r
-       public final static String PROTACTINIUM_ = "Pa";\r
-       public final static String URANIUM_ = "U";\r
-       public final static String NEPTUNIUM_ = "Np";\r
-       public final static String PLUTONIUM_ = "Pu";\r
-       public final static String AMERICIUM_ = "Am";\r
-       public final static String CURIUM_ = "Cm";\r
-       public final static String BERKELIUM_ = "Bk";\r
-       public final static String CALIFORNIUM_ = "Cf";\r
-       public final static String EINSTEINIUM_ = "Es";\r
-       public final static String FERMIUM_ = "Fm";\r
-       public final static String MENDILEVIUM_ = "Md";\r
-       public final static String NOBELIUM_ = "No";\r
-       public final static String LAWRENCIUM_ = "Lr";\r
-       public final static String RUTHERFORDIUM_ = "Rf";\r
-       public final static String DUBNIUM_ = "Db";\r
-       public final static String SEABORGIUM_ = "Sg";\r
-       public final static String BOHRIUM_ = "Bh";\r
-       public final static String HASSIUM_ = "Hs";\r
-       public final static String MEITNERIUM_ = "Mt";\r
-       public final static String DARMSTADTIUM_ = "Ds";\r
-       public final static String ROENTGENIUM_ = "Rg";\r
-       public final static String COPERNICIUM_ = "Cn";\r
-       public final static String UNUNTRIUM_ = "Uut";\r
-       public final static String UNUNQUADIUM_ = "Uuq";\r
-       public final static String UNUNPENTIUM_ = "Uup";\r
-       public final static String UNUNHEXIUM_ = "Uuh";\r
-       public final static String UNUNSEPTIUM_ = "Uus";\r
-       public final static String UNUNOCTIUM_ = "Uuo";\r
-\r
-       public final static String[] atomsList = {\r
-               "H","He","Li","Be","B","C","N","O","F","Ne",\r
-               "Na","Mg","Al","Si","P","S","Cl","Ar","K","Ca",\r
-               "Sc","Ti","V","Cr","Mn","Fe","Co","Ni","Cu","Zn",\r
-               "Ga","Ge","As","Se","Br","Kr","Rb","Sr","Y","Zr",\r
-               "Nb","Mo","Tc","Ru","Rh","Pd","Ag","Cd","In","Sn",\r
-               "Sb","Te","I","Xe","Cs","Ba","La","Ce","Pr","Pm",\r
-               "Sm","Eu","Gd","Tb","Dy","Ho","Er","Tm","Yb","Lu",\r
-               "Hf","Ta","W","Re","Os","Ir","Pt","Au","Hg","Tl",\r
-               "Pb","Bi","Po","At","Rn","Fr","Ra","Ac","Th","Pa",\r
-               "U","Np","Pu","Am","Cm","Bk","Cf","Es","Fm","Md",\r
-               "No","Lr","Rf","Db","Sg","Bh","Hs","Mt","Ds","Rg",\r
-               "Cn","Uut","Uuq","Uup","Uuh","Uus","Uuo"\r
+       public static final int HYDROGEN = 0;\r
+       public static final int HELIUM = 1;\r
+       public static final int LITHIUM = 2;\r
+       public static final int BERYLLIUM = 3;\r
+       public static final int BORON = 4;\r
+       public static final int CARBON = 5;\r
+       public static final int NITROGEN = 6;\r
+       public static final int OXYGEN = 7;\r
+       public static final int FLUORINE = 8;\r
+       public static final int NEON = 9;\r
+       public static final int SODIUM = 10;\r
+       public static final int MAGNESIUM = 11;\r
+       public static final int ALMINIUM = 12;\r
+       public static final int SILICON = 13;\r
+       public static final int PHOSPHORUS = 14;\r
+       public static final int SULFUR = 15;\r
+       public static final int CHLORINE = 16;\r
+       public static final int ARGON = 17;\r
+       public static final int POTASSIUM = 18;\r
+       public static final int CALCIUM = 19;\r
+       public static final int SCANDIUM = 20;\r
+       public static final int TITANIUM = 21;\r
+       public static final int VANADIUM = 22;\r
+       public static final int CHROMIUM = 23;\r
+       public static final int MANGANESE = 24;\r
+       public static final int IRON = 25;\r
+       public static final int COBALT = 26;\r
+       public static final int NICKEL = 27;\r
+       public static final int COPPER = 28;\r
+       public static final int ZINC = 29;\r
+       public static final int GALLIUM = 30;\r
+       public static final int GERMANIUM = 31;\r
+       public static final int ARSENIC = 32;\r
+       public static final int SELENIUM = 33;\r
+       public static final int BROMINE = 34;\r
+       public static final int KRYPTON = 35;\r
+       public static final int RUBIDIUM = 36;\r
+       public static final int STRONTIUM = 37;\r
+       public static final int YTTORIUM = 38;\r
+       public static final int ZIRCONIUM = 39;\r
+       public static final int NIOBIUM = 40;\r
+       public static final int MOLYBDENUM = 41;\r
+       public static final int TECHNETIUM = 42;\r
+       public static final int RUTHENIUM = 43;\r
+       public static final int RHODIUM = 44;\r
+       public static final int PALLADIUM = 45;\r
+       public static final int SILVER = 46;\r
+       public static final int CADMIUM = 47;\r
+       public static final int INDIUM = 48;\r
+       public static final int TIN = 49;\r
+       public static final int ANTIMONY = 50;\r
+       public static final int TELLURIUM = 51;\r
+       public static final int IODINE = 52;\r
+       public static final int XENON = 53;\r
+       public static final int CAESIUM = 54;\r
+       public static final int BARIUM = 55;\r
+       public static final int LANTHANUM = 56;\r
+       public static final int CERIUM = 57;\r
+       public static final int PRASEODYMIUM = 58;\r
+       public static final int NEODYMIUM = 59;\r
+       public static final int PROMETHIUM = 60;\r
+       public static final int SAMARIUM = 61;\r
+       public static final int EUROPIUM = 62;\r
+       public static final int GADOLINIUM = 63;\r
+       public static final int TERBIUM = 64;\r
+       public static final int DYSPROSIUM = 65;\r
+       public static final int HOLMIUM = 66;\r
+       public static final int ERBIUM = 67;\r
+       public static final int THULIUM = 68;\r
+       public static final int YTTERBIUM = 69;\r
+       public static final int LUTETIUM = 70;\r
+       public static final int HAFNIUM = 71;\r
+       public static final int TANTALUM = 72;\r
+       public static final int TUNGSTEN = 73;\r
+       public static final int RHENIUM = 74;\r
+       public static final int OSMIUM = 75;\r
+       public static final int IRIDIUM = 76;\r
+       public static final int PLATINUM = 77;\r
+       public static final int GOLD = 78;\r
+       public static final int MERCURY = 79;\r
+       public static final int THALLIUM = 80;\r
+       public static final int LEAD = 81;\r
+       public static final int BISMUTH = 82;\r
+       public static final int POLONIUM = 83;\r
+       public static final int ASTATINE = 84;\r
+       public static final int RADON = 85;\r
+       public static final int FRANCIUM = 86;\r
+       public static final int RADIUM = 87;\r
+       public static final int ACTINIUM = 88;\r
+       public static final int THORIUM = 89;\r
+       public static final int PROTACTINIUM = 90;\r
+       public static final int URANIUM = 91;\r
+       public static final int NEPTUNIUM = 92;\r
+       public static final int PLUTONIUM = 93;\r
+       public static final int AMERICIUM = 94;\r
+       public static final int CURIUM = 95;\r
+       public static final int BERKELIUM = 96;\r
+       public static final int CALIforNIUM = 97;\r
+       public static final int EINSTEINIUM = 98;\r
+       public static final int FERMIUM = 99;\r
+       public static final int MENDILEVIUM = 100;\r
+       public static final int NOBELIUM = 101;\r
+       public static final int LAWRENCIUM = 102;\r
+       public static final int RUTHERforDIUM = 103;\r
+       public static final int DUBNIUM = 104;\r
+       public static final int SEABORGIUM = 105;\r
+       public static final int BOHRIUM = 106;\r
+       public static final int HASSIUM = 107;\r
+       public static final int MEITNERIUM = 108;\r
+       public static final int DARMSTADTIUM = 109;\r
+       public static final int ROENTGENIUM = 110;\r
+       public static final int COPERNICIUM = 111;\r
+       public static final int UNUNTRIUM = 112;\r
+       public static final int UNUNQUADIUM = 113;\r
+       public static final int UNUNPENTIUM = 114;\r
+       public static final int UNUNHEXIUM = 115;\r
+       public static final int UNUNSEPTIUM = 116;\r
+       public static final int UNUNOCTIUM = 117;\r
+\r
+       public static final String HYDROGEN_SIGN = "H";\r
+       public static final String HELIUM_SIGN = "He";\r
+       public static final String LITHIUM_SIGN = "Li";\r
+       public static final String BERYLLIUM_SIGN = "Be";\r
+       public static final String BORON_SIGN = "B";\r
+       public static final String CARBON_SIGN = "C";\r
+       public static final String NITROGEN_SIGN = "N";\r
+       public static final String OXYGEN_SIGN = "O";\r
+       public static final String FLUORINE_SIGN = "F";\r
+       public static final String NEON_SIGN = "Ne";\r
+       public static final String SODIUM_SIGN = "Na";\r
+       public static final String MAGNESIUM_SIGN = "Mg";\r
+       public static final String ALMINIUM_SIGN = "Al";\r
+       public static final String SILICON_SIGN = "Si";\r
+       public static final String PHOSPHORUS_SIGN = "P";\r
+       public static final String SULFUR_SIGN = "S";\r
+       public static final String CHLORINE_SIGN = "Cl";\r
+       public static final String ARGON_SIGN = "Ar";\r
+       public static final String POTASSIUM_SIGN = "K";\r
+       public static final String CALCIUM_SIGN = "Ca";\r
+       public static final String SCANDIUM_SIGN = "Sc";\r
+       public static final String TITANIUM_SIGN = "Ti";\r
+       public static final String VANADIUM_SIGN = "V";\r
+       public static final String CHROMIUM_SIGN = "Cr";\r
+       public static final String MANGANESE_SIGN = "Mn";\r
+       public static final String IRON_SIGN = "Fe";\r
+       public static final String COBALT_SIGN = "Co";\r
+       public static final String NICKEL_SIGN = "Ni";\r
+       public static final String COPPER_SIGN = "Cu";\r
+       public static final String ZINC_SIGN = "Zn";\r
+       public static final String GALLIUM_SIGN = "Ga";\r
+       public static final String GERMANIUM_SIGN = "Ge";\r
+       public static final String ARSENIC_SIGN = "As";\r
+       public static final String SELENIUM_SIGN = "Se";\r
+       public static final String BROMINE_SIGN = "Br";\r
+       public static final String KRYPTON_SIGN = "Kr";\r
+       public static final String RUBIDIUM_SIGN = "Rb";\r
+       public static final String STRONTIUM_SIGN = "Sr";\r
+       public static final String YTTORIUM_SIGN = "Y";\r
+       public static final String ZIRCONIUM_SIGN = "Zr";\r
+       public static final String NIOBIUM_SIGN = "Nb";\r
+       public static final String MOLYBDENUM_SIGN = "Mo";\r
+       public static final String TECHNETIUM_SIGN = "Tc";\r
+       public static final String RUTHENIUM_SIGN = "Ru";\r
+       public static final String RHODIUM_SIGN = "Rh";\r
+       public static final String PALLADIUM_SIGN = "Pd";\r
+       public static final String SILVER_SIGN = "Ag";\r
+       public static final String CADMIUM_SIGN = "Cd";\r
+       public static final String INDIUM_SIGN = "In";\r
+       public static final String TIN_SIGN = "Sn";\r
+       public static final String ANTIMONY_SIGN = "Sb";\r
+       public static final String TELLURIUM_SIGN = "Te";\r
+       public static final String IODINE_SIGN = "I";\r
+       public static final String XENON_SIGN = "Xe";\r
+       public static final String CAESIUM_SIGN = "Cs";\r
+       public static final String BARIUM_SIGN = "Ba";\r
+       public static final String LANTHANUM_SIGN = "La";\r
+       public static final String CERIUM_SIGN = "Ce";\r
+       public static final String PRASEODYMIUM_SIGN = "Pr";\r
+       public static final String NEODYMIUM_SIGN = "Nd";\r
+       public static final String PROMETHIUM_SIGN = "Pm";\r
+       public static final String SAMARIUM_SIGN = "Sm";\r
+       public static final String EUROPIUM_SIGN = "Eu";\r
+       public static final String GADOLINIUM_SIGN = "Gd";\r
+       public static final String TERBIUM_SIGN = "Tb";\r
+       public static final String DYSPROSIUM_SIGN = "Dy";\r
+       public static final String HOLMIUM_SIGN = "Ho";\r
+       public static final String ERBIUM_SIGN = "Er";\r
+       public static final String THULIUM_SIGN = "Tm";\r
+       public static final String YTTERBIUM_SIGN = "Yb";\r
+       public static final String LUTETIUM_SIGN = "Lu";\r
+       public static final String HAFNIUM_SIGN = "Hf";\r
+       public static final String TANTALUM_SIGN = "Ta";\r
+       public static final String TUNGSTEN_SIGN = "W";\r
+       public static final String RHENIUM_SIGN = "Re";\r
+       public static final String OSMIUM_SIGN = "Os";\r
+       public static final String IRIDIUM_SIGN = "Ir";\r
+       public static final String PLATINUM_SIGN = "Pt";\r
+       public static final String GOLD_SIGN = "Au";\r
+       public static final String MERCURY_SIGN = "Hg";\r
+       public static final String THALLIUM_SIGN = "Tl";\r
+       public static final String LEAD_SIGN = "Pb";\r
+       public static final String BISMUTH_SIGN = "Bi";\r
+       public static final String POLONIUM_SIGN = "Po";\r
+       public static final String ASTATINE_SIGN = "At";\r
+       public static final String RADON_SIGN = "Rn";\r
+       public static final String FRANCIUM_SIGN = "Fr";\r
+       public static final String RADIUM_SIGN = "Ra";\r
+       public static final String ACTINIUM_SIGN = "Ac";\r
+       public static final String THORIUM_SIGN = "Th";\r
+       public static final String PROTACTINIUM_SIGN = "Pa";\r
+       public static final String URANIUM_SIGN = "U";\r
+       public static final String NEPTUNIUM_SIGN = "Np";\r
+       public static final String PLUTONIUM_SIGN = "Pu";\r
+       public static final String AMERICIUM_SIGN = "Am";\r
+       public static final String CURIUM_SIGN = "Cm";\r
+       public static final String BERKELIUM_SIGN = "Bk";\r
+       public static final String CALIforNIUM_SIGN = "Cf";\r
+       public static final String EINSTEINIUM_SIGN = "Es";\r
+       public static final String FERMIUM_SIGN = "Fm";\r
+       public static final String MENDILEVIUM_SIGN = "Md";\r
+       public static final String NOBELIUM_SIGN = "No";\r
+       public static final String LAWRENCIUM_SIGN = "Lr";\r
+       public static final String RUTHERforDIUM_SIGN = "Rf";\r
+       public static final String DUBNIUM_SIGN = "Db";\r
+       public static final String SEABORGIUM_SIGN = "Sg";\r
+       public static final String BOHRIUM_SIGN = "Bh";\r
+       public static final String HASSIUM_SIGN = "Hs";\r
+       public static final String MEITNERIUM_SIGN = "Mt";\r
+       public static final String DARMSTADTIUM_SIGN = "Ds";\r
+       public static final String ROENTGENIUM_SIGN = "Rg";\r
+       public static final String COPERNICIUM_SIGN = "Cn";\r
+       public static final String UNUNTRIUM_SIGN = "Uut";\r
+       public static final String UNUNQUADIUM_SIGN = "Uuq";\r
+       public static final String UNUNPENTIUM_SIGN = "Uup";\r
+       public static final String UNUNHEXIUM_SIGN = "Uuh";\r
+       public static final String UNUNSEPTIUM_SIGN = "Uus";\r
+       public static final String UNUNOCTIUM_SIGN = "Uuo";\r
+\r
+       public static final String[] ATOMSLIST = {\r
+               "H",  "He",  "Li",  "Be",  "B",  "C",  "N",  "O",  "F",  "Ne",\r
+               "Na",  "Mg",  "Al",  "Si",  "P",  "S",  "Cl",  "Ar",  "K",  "Ca",\r
+               "Sc",  "Ti",  "V",  "Cr",  "Mn",  "Fe",  "Co",  "Ni",  "Cu",  "Zn",\r
+               "Ga",  "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr",\r
+               "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn",\r
+               "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Pm",\r
+               "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu",\r
+               "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl",\r
+               "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa",\r
+               "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md",\r
+               "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg",\r
+               "Cn", "Uut", "Uuq", "Uup", "Uuh", "Uus", "Uuo"\r
        };\r
 \r
 }
\ No newline at end of file
index 2a826e8..330e1c0 100644 (file)
@@ -20,7 +20,7 @@ public class ChemiCraftAPI {
        /**
         * Instance of the ChemiCraftAPI.
         */
-       public static final ChemiCraftAPI instance = new ChemiCraftAPI();
+       private static ChemiCraftAPI instance = new ChemiCraftAPI();
 
 
        /**
@@ -72,9 +72,15 @@ public class ChemiCraftAPI {
 
 
        /**
-        * 化合台の素材のリスト
+        * 化合台の原子の種類のリスト
         */
-       private ArrayList<ItemStack[]> chemicalCombinationMaterials = new ArrayList<ItemStack[]>();
+       private ArrayList<String[]> chemicalCombinationAtoms = new ArrayList<String[]>();
+
+
+       /**
+        * 化合台の原子の数のリスト
+        */
+       private ArrayList<Integer[]> chemicalCombinationAmounts = new ArrayList<Integer[]>();
 
 
        /**
@@ -177,13 +183,10 @@ public class ChemiCraftAPI {
         * @param material 素材
         * @param result 結果
         */
-       public void addChemicalCombinationRecipe(ItemStack[] material, ItemStack result){
-               if(material.length <= 16){
-                       chemicalCombinationMaterials.add(material);
-                       chemicalCombinationResult.add(result);
-               }else{
-                       System.err.println("ChemiCraft内でエラー:addChemicalCombinationRecipeの引数materialの要素数が16を超えています。" + "Material:" + material + "  Result:" + result);
-               }
+       public void addChemicalCombinationRecipe(String[] atoms, Integer[] amounts, ItemStack result){
+               chemicalCombinationAtoms.add(atoms);
+               chemicalCombinationAmounts.add(amounts);
+               chemicalCombinationResult.add(result);
        }
 
 
@@ -245,8 +248,14 @@ public class ChemiCraftAPI {
 
 
 
-       public ArrayList<ItemStack[]> getChemicalCombinationMaterial(){
-               return chemicalCombinationMaterials;
+       public ArrayList<String[]> getChemicalCombinationAtoms(){
+               return chemicalCombinationAtoms;
+       }
+
+
+
+       public ArrayList<Integer[]> getChemicalCombinationAmounts(){
+               return chemicalCombinationAmounts;
        }
 
 
@@ -255,12 +264,22 @@ public class ChemiCraftAPI {
                return chemicalCombinationResult;
        }
 
+
+
        public ArrayList<MaterialRecipe> getMaterialRecipe(){
                return materialRecipe;
        }
 
+
+
        public ChemiCraftCraftingManager getCraftingManager(){
                return chemiCraftCraftingManager;
        }
 
+
+
+       public static ChemiCraftAPI getInstance(){
+               return instance;
+       }
+
 }
index 968680e..d845741 100644 (file)
@@ -1,11 +1,15 @@
 package chemicraft.container;
 
+import cpw.mods.fml.common.network.PacketDispatcher;
 import net.minecraft.src.Container;
 import net.minecraft.src.EntityPlayer;
+import net.minecraft.src.IInventory;
 import net.minecraft.src.ItemStack;
 import net.minecraft.src.Slot;
+import net.minecraft.src.TileEntity;
 import net.minecraft.src.World;
 import chemicraft.ChemiCraft;
+import chemicraft.ChemiCraftAPI;
 import chemicraft.inventory.InventoryChemicalCombinationTableMaterial;
 import chemicraft.inventory.InventoryChemicalCombinationTableResult;
 import chemicraft.slot.SlotChemicalCombinationTableMaterial;
@@ -37,8 +41,14 @@ public class ContainerChemicalCombinationTable extends Container {
        private InventoryChemicalCombinationTableMaterial invm;
        private InventoryChemicalCombinationTableResult invr;
 
+       /**
+        * the EntityPlayer.
+        */
+       private EntityPlayer entityplayer;
+
        public ContainerChemicalCombinationTable(EntityPlayer par1EntityPlayer, TileEntityChemicalCombinationTable par2) {
                super();
+               this.entityplayer = par1EntityPlayer;
                this.tileentity = par2;
                this.worldObj = tileentity.worldObj;
                this.posX = tileentity.xCoord;
@@ -68,6 +78,14 @@ public class ContainerChemicalCombinationTable extends Container {
                {
                        this.addSlotToContainer(new Slot(par1EntityPlayer.inventory, var3, 8 + var3 * 18, 143));
                }
+
+               this.invm.setEventHandler(this);
+               this.onCraftMatrixChanged(invm);
+       }
+
+       @Override
+       public void onCraftMatrixChanged(IInventory par1IInventory){
+               this.invr.setInventorySlotContents(0, ChemiCraftAPI.getInstance().getCraftingManager().getChemicalCombinationResult(this.tileentity.getAtomsList(), this.tileentity.getAtomsAmountList()));
        }
 
        @Override
@@ -81,6 +99,17 @@ public class ContainerChemicalCombinationTable extends Container {
        }
 
        @Override
+       public ItemStack slotClick(int par1, int par2, boolean par3, EntityPlayer par4EntityPlayer) {
+               if (par1 == 16) {
+                       if (this.invr.getStackInSlot(0) != null) {
+                               this.tileentity.emptytoAtomsList();
+                               return super.slotClick(par1, par2, par3, par4EntityPlayer);
+                       }
+               }
+               return super.slotClick(par1, par2, par3, par4EntityPlayer);
+       }
+
+       @Override
        public void onCraftGuiClosed(EntityPlayer par1EntityPlayer){
                super.onCraftGuiClosed(par1EntityPlayer);
        }
index 3598a74..f31b169 100644 (file)
@@ -84,7 +84,7 @@ public class ContainerChemicalCraftingTable extends Container {
 
        @Override
        public void onCraftMatrixChanged(IInventory par1IInventory){
-               this.useNBT = ChemiCraftAPI.instance.getCraftingManager().chemicalCrafting(this.invm, this.invr, this.invn);
+               this.useNBT = ChemiCraftAPI.getInstance().getCraftingManager().chemicalCrafting(this.invm, this.invr, this.invn);
        }
 
        @Override
index ce2c079..6fac8dc 100644 (file)
@@ -1,19 +1,20 @@
 package chemicraft.gui;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 
+import net.minecraft.src.EntityItem;
 import net.minecraft.src.EntityPlayer;
 import net.minecraft.src.GuiButton;
 import net.minecraft.src.GuiContainer;
 import net.minecraft.src.GuiTextField;
 import net.minecraft.src.IInventory;
 import net.minecraft.src.ItemStack;
+import net.minecraft.src.World;
 import chemicraft.ChemiCraft;
 import chemicraft.container.ContainerChemicalCombinationTable;
 import chemicraft.tileentity.TileEntityChemicalCombinationTable;
 import chemicraft.util.ComparatorItemStack;
-import cpw.mods.fml.common.Side;
-import cpw.mods.fml.common.asm.SideOnly;
 import cpw.mods.fml.common.network.PacketDispatcher;
 
 public class GuiChemicalCombinationTable extends GuiContainer {
@@ -44,18 +45,17 @@ public class GuiChemicalCombinationTable extends GuiContainer {
        }
 
        @Override
-       @SideOnly(Side.CLIENT)
        protected void actionPerformed(GuiButton par1GuiButton) {
                if(par1GuiButton.id == 0){
                        this.field_00001(this.tileentity);
                        PacketDispatcher.sendPacketToServer(this.tileentity.getDescriptionPacket());
                }else if(par1GuiButton.id == 1){
-
+                       this.field_00002(this.tileentity);
+                       PacketDispatcher.sendPacketToServer(this.tileentity.getDescriptionPacket());
                }
                return;
        }
 
-       @SideOnly(Side.CLIENT)
        protected void field_00001(TileEntityChemicalCombinationTable par1){
                IInventory inv = par1.getInvMaterial();
                ItemStack[] stacks = new ItemStack[inv.getSizeInventory()];
@@ -69,16 +69,47 @@ public class GuiChemicalCombinationTable extends GuiContainer {
 
                for(int i = 0;i < stacks.length;i++){
                        if(stacks[i].stackSize > 1){
-                               par1.setAtoms(ChemiCraft.atomsList[stacks[i].getItemDamage()], stacks[i].stackSize);
+                               par1.setAtoms(ChemiCraft.ATOMSLIST[stacks[i].getItemDamage()], stacks[i].stackSize);
                        }else{
-                               par1.setAtoms(ChemiCraft.atomsList[stacks[i].getItemDamage()], 1);
+                               par1.setAtoms(ChemiCraft.ATOMSLIST[stacks[i].getItemDamage()], 1);
                        }
                }
 
-               for(int i = 0;i < stacks.length;i++){
+               for(int i = 0;i < inv.getSizeInventory();i++){
                        inv.setInventorySlotContents(i, null);
                }
+       }
 
+       protected void field_00002(TileEntityChemicalCombinationTable par1) {
+               ArrayList<String> var1 = par1.getAtomsList();
+               ArrayList<Integer> var2 = par1.getAtomsAmountList();
+
+               for (int i = 0;i < var1.size();i++) {
+                       for (int j = 0;j < ChemiCraft.ATOMSLIST.length;j++) {
+                               if (var1.get(i).equals(ChemiCraft.ATOMSLIST[j])) {
+                                       int var3 = var2.get(i);
+                                       while(var3 > 0){
+                                               if(var3 > 64){
+                                                       ItemStack itemstack = new ItemStack(ChemiCraft.instance.itemAtoms, 64, j);
+                                                       this.tileentity.setDropItems(itemstack);
+                                                       PacketDispatcher.sendPacketToServer(this.tileentity.getDescriptionPacket());
+                                                       var3 -= 64;
+                                               }else{
+                                                       ItemStack itemstack = new ItemStack(ChemiCraft.instance.itemAtoms, var3, j);
+                                                       this.tileentity.setDropItems(itemstack);
+                                                       PacketDispatcher.sendPacketToServer(this.tileentity.getDescriptionPacket());
+                                                       var3 = 0;
+                                               }
+                                       }
+                                       break;
+                               }
+                       }
+               }
+               IInventory invr = par1.getInvResult();
+               if (invr.getStackInSlot(0) != null) {
+                       invr.setInventorySlotContents(0, null);
+               }
+               par1.emptytoAtomsList();
        }
 
        @Override
index 58ad121..0d41fd1 100644 (file)
@@ -2,15 +2,15 @@ package chemicraft.item;
 
 import java.util.List;
 
-import cpw.mods.fml.common.Side;
-import cpw.mods.fml.common.asm.SideOnly;
-
+import net.minecraft.src.Entity;
 import net.minecraft.src.EntityPlayer;
 import net.minecraft.src.Item;
 import net.minecraft.src.ItemStack;
 import net.minecraft.src.NBTTagCompound;
 import net.minecraft.src.NBTTagList;
 import net.minecraft.src.World;
+import net.minecraft.src.WorldClient;
+import net.minecraft.src.WorldServer;
 import chemicraft.entity.EntityAtomGrenade;
 
 public class ItemAtomGrenade extends Item {
@@ -19,6 +19,7 @@ public class ItemAtomGrenade extends Item {
                super(par1);
        }
 
+       @Override
        public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer){
                if(par1ItemStack.stackSize <= 0){
                        return null;
@@ -53,6 +54,7 @@ public class ItemAtomGrenade extends Item {
 
        @Override
        public void addInformation(ItemStack par1ItemStack, List par2List) {
+               ItemStack var2 = new ItemStack(this);
                if(par1ItemStack.hasTagCompound()){
                        NBTTagList var1 = par1ItemStack.getTagCompound().getTagList("Effect");
 
@@ -67,6 +69,12 @@ public class ItemAtomGrenade extends Item {
        }
 
        @Override
+       public boolean getShareTag()
+       {
+               return true;
+       }
+
+       @Override
        public String getTextureFile(){
                return "/chemicraft/items/items.png";
        }
index 45f5404..2970d0f 100644 (file)
@@ -25,7 +25,7 @@ public class ItemAtoms extends Item {
        @SideOnly(Side.CLIENT)
        @Override
        public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List){
-               for(int type = 0; type < ChemiCraft.instance.atomsName.length; type++)
+               for(int type = 0; type < ChemiCraft.instance.ATOMSNAME.length; type++)
                {
                        par3List.add(new ItemStack(par1, 1, type));
                        this.setIconIndex(type);
@@ -36,7 +36,7 @@ public class ItemAtoms extends Item {
 
        @Override
        public String getItemNameIS(ItemStack par1ItemStack){
-               return super.getItemName() + "." + ChemiCraft.instance.atomsName[par1ItemStack.getItemDamage()];
+               return super.getItemName() + "." + ChemiCraft.instance.ATOMSNAME[par1ItemStack.getItemDamage()];
        }
 
 
index 1f6d205..b511e9c 100644 (file)
@@ -24,9 +24,9 @@ public class ItemCompounds extends Item {
 
        @Override
        public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
-               for(int i=0;i < ChemiCraftAPI.instance.getCompoundHandlerItemName().size();i++){
-                       if(ChemiCraftAPI.instance.getCompoundsName().get(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.instance.getCompoundHandlerItemName().get(i))){
-                               return ChemiCraftAPI.instance.getCompoundHandler().get(i).onItemUseHandler(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10);
+               for(int i=0;i < ChemiCraftAPI.getInstance().getCompoundHandlerItemName().size();i++){
+                       if(ChemiCraftAPI.getInstance().getCompoundsName().get(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.getInstance().getCompoundHandlerItemName().get(i))){
+                               return ChemiCraftAPI.getInstance().getCompoundHandler().get(i).onItemUseHandler(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10);
                        }
                }
                return false;
@@ -36,9 +36,9 @@ public class ItemCompounds extends Item {
        @Override
        public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
        {
-               for(int i=0;i < ChemiCraftAPI.instance.getCompoundHandlerItemName().size();i++){
-                       if(ChemiCraftAPI.instance.getCompoundsName().get(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.instance.getCompoundHandlerItemName().get(i))){
-                               ChemiCraftAPI.instance.getCompoundHandler().get(i).onItemRightClickHandler(par1ItemStack, par2World, par3EntityPlayer);
+               for(int i=0;i < ChemiCraftAPI.getInstance().getCompoundHandlerItemName().size();i++){
+                       if(ChemiCraftAPI.getInstance().getCompoundsName().get(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.getInstance().getCompoundHandlerItemName().get(i))){
+                               ChemiCraftAPI.getInstance().getCompoundHandler().get(i).onItemRightClickHandler(par1ItemStack, par2World, par3EntityPlayer);
                        }
                }
                return par1ItemStack;
@@ -48,9 +48,9 @@ public class ItemCompounds extends Item {
 
        @Override
        public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5){
-               for(int i=0;i < ChemiCraftAPI.instance.getCompoundHandlerItemName().size();i++){
-                       if(ChemiCraftAPI.instance.getCompoundsName().get(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.instance.getCompoundHandlerItemName().get(i))){
-                               ChemiCraftAPI.instance.getCompoundHandler().get(i).onUpdateHandler(par1ItemStack, par2World, par3Entity, par4, par5);
+               for(int i=0;i < ChemiCraftAPI.getInstance().getCompoundHandlerItemName().size();i++){
+                       if(ChemiCraftAPI.getInstance().getCompoundsName().get(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.getInstance().getCompoundHandlerItemName().get(i))){
+                               ChemiCraftAPI.getInstance().getCompoundHandler().get(i).onUpdateHandler(par1ItemStack, par2World, par3Entity, par4, par5);
                        }
                }
        }
@@ -61,7 +61,7 @@ public class ItemCompounds extends Item {
        @SideOnly(Side.CLIENT)
        @Override
        public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List){
-               for(int type = 0; type < ChemiCraftAPI.instance.getCompoundsName().toArray().length; type++)
+               for(int type = 0; type < ChemiCraftAPI.getInstance().getCompoundsName().toArray().length; type++)
                {
                        par3List.add(new ItemStack(par1, 1, type));
                        this.setIconIndex(type);
@@ -72,7 +72,7 @@ public class ItemCompounds extends Item {
 
        @Override
        public String getItemNameIS(ItemStack par1ItemStack){
-               return super.getItemName() + "." + ChemiCraftAPI.instance.getCompoundsName().toArray()[par1ItemStack.getItemDamage()];
+               return super.getItemName() + "." + ChemiCraftAPI.getInstance().getCompoundsName().toArray()[par1ItemStack.getItemDamage()];
        }
 
 
@@ -87,9 +87,9 @@ public class ItemCompounds extends Item {
        @SideOnly(Side.CLIENT)
        @Override
        public int getIconFromDamage(int par1){
-               for(int i=0;i < ChemiCraftAPI.instance.getCompoundHandlerItemName().size();i++){
-                       if(ChemiCraftAPI.instance.getCompoundsName().get(par1).equals(ChemiCraftAPI.instance.getCompoundHandlerItemName().get(i))){
-                               return ChemiCraftAPI.instance.getCompoundHandler().get(i).getIconIndexHandler();
+               for(int i=0;i < ChemiCraftAPI.getInstance().getCompoundHandlerItemName().size();i++){
+                       if(ChemiCraftAPI.getInstance().getCompoundsName().get(par1).equals(ChemiCraftAPI.getInstance().getCompoundHandlerItemName().get(i))){
+                               return ChemiCraftAPI.getInstance().getCompoundHandler().get(i).getIconIndexHandler();
                        }
                }
                return 0;
index 73e408a..8f07fa6 100644 (file)
@@ -42,7 +42,7 @@ public class ItemGasCollectingBottle extends ItemAtomInfoContainer
                                }
                        } else {
                                if (result3 == 0) {
-                                       this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, ChemiCraftAPI.instance.getCompound("CarbonDioxide")), par3EntityPlayer);
+                                       this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, ChemiCraftAPI.getInstance().getCompound("CarbonDioxide")), par3EntityPlayer);
                                } else if (result3 == 1) {
                                        this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 9), par3EntityPlayer);
                                } else if (result3 == 2) {
@@ -80,7 +80,7 @@ public class ItemGasCollectingBottle extends ItemAtomInfoContainer
                        int result1 = MathHelperPlus.probability(99, 1);
 
                        if (result1 == 0) {
-                               this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, ChemiCraftAPI.instance.getCompound("CarbonDioxide")), par2EntityPlayer);
+                               this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, ChemiCraftAPI.getInstance().getCompound("CarbonDioxide")), par2EntityPlayer);
                        } else {
                                this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 17), par2EntityPlayer);
                        }
index d4ce381..1276452 100644 (file)
@@ -1,7 +1,6 @@
 package chemicraft.system;
 
 import java.util.ArrayList;
-import java.util.Collections;
 
 import net.minecraft.src.IInventory;
 import net.minecraft.src.ItemStack;
@@ -10,6 +9,7 @@ import chemicraft.inventory.InventoryChemicalCraftingMaterial;
 import chemicraft.inventory.InventoryChemicalCraftingNBT;
 import chemicraft.inventory.InventoryChemicalCraftingResult;
 import chemicraft.util.ChemicalNBTRecipe;
+import chemicraft.util.FormulaPart;
 
 public class ChemiCraftCraftingManager {
 
@@ -18,25 +18,25 @@ public class ChemiCraftCraftingManager {
                /*
                 * Commented by mozipi.
                ((InventoryDecomposition)par1IInventory).setFlag(false);
-               */
+                */
 
                //variable of results.
                ItemStack[] results = null;
 
                //Just loop of amount of added recipe.
-               for(int i1 = 0;i1 < ChemiCraftAPI.instance.getDecompositionMaterial().size();i1++){
+               for(int i1 = 0;i1 < ChemiCraftAPI.getInstance().getDecompositionMaterial().size();i1++){
                        //Check of null of the Material Slot.
                        if(par1IInventory.getStackInSlot(16) == null){ this.clearResults(par1IInventory, 16); return new ItemStack[16];}
                        //Recipe the match?
                        boolean match = true;
                        //Reset the results.
-                       results  = new ItemStack[ChemiCraftAPI.instance.getDecompositionResult().get(i1).length];
+                       results  = new ItemStack[ChemiCraftAPI.getInstance().getDecompositionResult().get(i1).length];
                        //Recipe ID & Damage.
                        //Material ID & Damage.
                        int materialID = par1IInventory.getStackInSlot(16).itemID;
                        int materialDamage = par1IInventory.getStackInSlot(16).getItemDamage();
-                       int recipeID = ChemiCraftAPI.instance.getDecompositionMaterial().get(i1).itemID;
-                       int recipeDamage = ChemiCraftAPI.instance.getDecompositionMaterial().get(i1).getItemDamage();
+                       int recipeID = ChemiCraftAPI.getInstance().getDecompositionMaterial().get(i1).itemID;
+                       int recipeDamage = ChemiCraftAPI.getInstance().getDecompositionMaterial().get(i1).getItemDamage();
 
                        //ID check.
                        if(materialID != recipeID){ match = false;}
@@ -46,12 +46,12 @@ public class ChemiCraftCraftingManager {
                        //if "match == true"
                        if(match){
                                //Just loop of recipe size of recipe index i1.
-                               for(int i = 0;i < ChemiCraftAPI.instance.getDecompositionResult().get(i1).length;i++){
+                               for(int i = 0;i < ChemiCraftAPI.getInstance().getDecompositionResult().get(i1).length;i++){
                                        //Assignment to the results.
                                        results[i] = new ItemStack(
-                                                       ChemiCraftAPI.instance.getDecompositionResult().get(i1)[i].itemID,
-                                                       ChemiCraftAPI.instance.getDecompositionResult().get(i1)[i].stackSize,
-                                                       ChemiCraftAPI.instance.getDecompositionResult().get(i1)[i].getItemDamage()
+                                                       ChemiCraftAPI.getInstance().getDecompositionResult().get(i1)[i].itemID,
+                                                       ChemiCraftAPI.getInstance().getDecompositionResult().get(i1)[i].stackSize,
+                                                       ChemiCraftAPI.getInstance().getDecompositionResult().get(i1)[i].getItemDamage()
                                                        );
                                }
                                //return the results.
@@ -64,86 +64,34 @@ public class ChemiCraftCraftingManager {
 
 
 
-       public ItemStack getChemicalCombinationResult(IInventory par1IInventory){
-               //Setting to flag.
-               /*
-                * Commented by mozipi.
-               ((InventoryChemicalCombination) par1IInventory).setFlag(false);
-               */
-
-               //variable of result.
-               ItemStack result = null;
-
-               //Just loop of amount of added recipe.
-               for(int i = 0;i < ChemiCraftAPI.instance.getChemicalCombinationMaterial().size();i++){
-
-                       //Recipe the match?
-                       boolean match = true;
-                       //materialID & recipeID
-                       ArrayList<Integer> materialID = new ArrayList<Integer>();
-                       ArrayList<Integer> materialDamage = new ArrayList<Integer>();
-                       ArrayList<Integer> recipeID = new ArrayList<Integer>();
-                       ArrayList<Integer> recipeDamage = new ArrayList<Integer>();
-
-                       //Just loop of recipe size of recipe index i.
-                       for(int j = 0;j < ChemiCraftAPI.instance.getChemicalCombinationMaterial().get(i).length;j++){
-                               //Adding the recipe ID & Damage.
-                               recipeID.add(ChemiCraftAPI.instance.getChemicalCombinationMaterial().get(i)[j].itemID);
-                               recipeDamage.add(ChemiCraftAPI.instance.getChemicalCombinationMaterial().get(i)[j].getItemDamage());
+       public ItemStack getChemicalCombinationResult(ArrayList<String> atomsList, ArrayList<Integer> atomsAmountList){
+               ChemiCraftAPI api = ChemiCraftAPI.getInstance();
+               for (int i = 0; i < api.getChemicalCombinationAtoms().size(); i++) {
+                       FormulaPart[] var1 = new FormulaPart[atomsList.size()];
+                       FormulaPart[] var2 = new FormulaPart[api.getChemicalCombinationAtoms().get(i).length];
+                       for (int j = 0; j < atomsList.size(); j++) {
+                               var1[j] = new FormulaPart(atomsList.get(j), atomsAmountList.get(j));
                        }
-                       //Just loop of 16.
-                       for(int j = 0;j < 16;j++){
-                               //Null check
-                               if(par1IInventory.getStackInSlot(j) != null){
-                                       //Adding the materialID & Damage.
-                                       materialID.add(par1IInventory.getStackInSlot(j).itemID);
-                                       materialDamage.add(par1IInventory.getStackInSlot(j).getItemDamage());
-                               }
+                       for (int j = 0; j < api.getChemicalCombinationAtoms().get(i).length; j++) {
+                               var2[j] = new FormulaPart(api.getChemicalCombinationAtoms().get(i)[j], api.getChemicalCombinationAmounts().get(i)[j]);
                        }
-
-                       //trimToSize & sorting.
-                       Collections.sort(materialID);
-                       Collections.sort(materialDamage);
-                       Collections.sort(recipeID);
-                       Collections.sort(recipeDamage);
-                       materialID.trimToSize();
-                       materialDamage.trimToSize();
-                       recipeID.trimToSize();
-                       recipeDamage.trimToSize();
-
-                       //Size check.
-                       if(materialID.size() != recipeID.size()){ match = false;}
-                       //Just loop of materialID.size().
-                       for(int j = 0;j < materialID.size();j++){
-                               if(match){
-                                       //ID check.
-                                       if(materialID.get(j) != recipeID.get(j).hashCode()){ match = false;}
-                                       //Damage check.
-                                       if(materialDamage.get(j) != recipeDamage.get(j).hashCode()){ match = false;}
-                               }
+                       if (var1.length != var2.length) {
+                               continue;
                        }
-
-                       //if "match == true"
-                       if(match){
-                               //Assignment to the result.
-                               result =
-                                               new ItemStack(
-                                                               ChemiCraftAPI.instance.getChemicalCombinationResult().get(i).itemID,
-                                                               ChemiCraftAPI.instance.getChemicalCombinationResult().get(i).stackSize,
-                                                               ChemiCraftAPI.instance.getChemicalCombinationResult().get(i).getItemDamage()
-                                                               );
-                               //return the result.
-                               return result;
+                       for (int j = 0; j < var1.length; j++) {
+                               if (!var1[j].equals(var2[j])) {
+                                       continue;
+                               }
                        }
+                       return api.getChemicalCombinationResult().get(i);
                }
-               //return the null.
                return null;
        }
 
 
 
        public ChemicalNBTRecipe chemicalCrafting(InventoryChemicalCraftingMaterial par1IInventory, InventoryChemicalCraftingResult par2IInventory, InventoryChemicalCraftingNBT par3IInventory){
-               ChemiCraftAPI api = ChemiCraftAPI.instance;
+               ChemiCraftAPI api = ChemiCraftAPI.getInstance();
                ChemicalNBTRecipe returnObj = null;
                for(int i = 0;i < api.getMaterialRecipe().size();i++){
                        ItemStack result = api.getMaterialRecipe().get(i).match(par1IInventory);
@@ -170,7 +118,7 @@ public class ChemiCraftCraftingManager {
                /*
                 * Commented by mozipi.
                ((InventoryDecomposition)par1IInventory).setFlag(false);
-               */
+                */
                for(int i = 0;i < par2;i++){
                        par1IInventory.setInventorySlotContents(i, null);
                }
index c738a44..d0d3607 100644 (file)
@@ -3,12 +3,12 @@ package chemicraft.tileentity;
 import java.io.DataOutputStream;
 import java.util.ArrayList;
 
+import net.minecraft.src.EntityItem;
 import net.minecraft.src.ItemStack;
 import net.minecraft.src.NBTTagCompound;
 import net.minecraft.src.NBTTagList;
 import net.minecraft.src.Packet;
 import net.minecraft.src.TileEntity;
-import net.minecraft.src.WorldServer;
 import chemicraft.inventory.InventoryChemicalCombinationTableMaterial;
 import chemicraft.inventory.InventoryChemicalCombinationTableResult;
 import chemicraft.system.PacketHandler;
@@ -28,17 +28,11 @@ public class TileEntityChemicalCombinationTable extends TileEntity {
        private ArrayList<Integer> atomsAmountList = new ArrayList<Integer>();
        private int atomsListSize = 0;
 
-       int t = 0;
+       private ItemStack dropItems;
 
        @Override
        public void updateEntity(){
                super.updateEntity();
-               t++;
-               if(t % 5 == 0 && this.worldObj instanceof WorldServer){
-                       System.out.println(this.atomsListSize);
-                       System.out.println(this.atomsList);
-                       System.out.println(this.atomsAmountList);
-               }
        }
 
        @Override
@@ -50,7 +44,7 @@ public class TileEntityChemicalCombinationTable extends TileEntity {
                        NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3);
                        int var5 = var4.getByte("Slot") & 255;
 
-                       if (var5 >= 0 && var5 < this.invm.getSizeInventory())
+                       if  (var5 >= 0 && var5 < this.invm.getSizeInventory())
                        {
                                this.invm.setInventorySlotContents(var5, ItemStack.loadItemStackFromNBT(var4));
                        }
@@ -62,7 +56,7 @@ public class TileEntityChemicalCombinationTable extends TileEntity {
                        NBTTagCompound var7 = (NBTTagCompound)var6.tagAt(var3);
                        int var8 = var7.getByte("Slot2") & 255;
 
-                       if (var8 >= 0 && var8 < this.invr.getSizeInventory())
+                       if  (var8 >= 0 && var8 < this.invr.getSizeInventory())
                        {
                                this.invr.setInventorySlotContents(var8, ItemStack.loadItemStackFromNBT(var7));
                        }
@@ -70,10 +64,10 @@ public class TileEntityChemicalCombinationTable extends TileEntity {
 
                this.atomsListSize = par1.getInteger("atomsListSize");
                for(int i = 0;i < this.atomsListSize;i++){
-                       this.atomsList.add(par1.getString("atomsList") + i);
+                       this.atomsList.add(par1.getString("atomsList" + i));
                }
                for(int i = 0;i < this.atomsListSize;i++){
-                       this.atomsAmountList.add(par1.getInteger("atomsAmountList") + i);
+                       this.atomsAmountList.add(par1.getInteger("atomsAmountList" + i));
                }
        }
 
@@ -83,7 +77,7 @@ public class TileEntityChemicalCombinationTable extends TileEntity {
                NBTTagList var2 = new NBTTagList();
                for (int var3 = 0; var3 < this.invm.getSizeInventory(); ++var3)
                {
-                       if (this.invm.getStackInSlot(var3) != null)
+                       if  (this.invm.getStackInSlot(var3) != null)
                        {
                                NBTTagCompound var4 = new NBTTagCompound();
                                var4.setByte("Slot", (byte)var3);
@@ -96,7 +90,7 @@ public class TileEntityChemicalCombinationTable extends TileEntity {
                NBTTagList var5 = new NBTTagList();
                for (int var6 = 0; var6 < this.invr.getSizeInventory(); ++var6)
                {
-                       if (this.invr.getStackInSlot(var6) != null)
+                       if  (this.invr.getStackInSlot(var6) != null)
                        {
                                NBTTagCompound var7 = new NBTTagCompound();
                                var7.setByte("Slot2", (byte)var6);
@@ -109,15 +103,14 @@ public class TileEntityChemicalCombinationTable extends TileEntity {
                this.atomsList.trimToSize();
                this.atomsAmountList.trimToSize();
                for(int i = 0;i < this.atomsList.size();i++){
-                       par1.setString("atoms" + i, this.atomsList.get(i));
+                       par1.setString("atomsList" + i, this.atomsList.get(i));
                }
                for(int i = 0;i < this.atomsAmountList.size();i++){
-                       par1.setInteger("atomsAmount" + i, this.atomsAmountList.get(i));
+                       par1.setInteger("atomsAmountList" + i, this.atomsAmountList.get(i));
                }
 
                this.atomsListSize = this.atomsList.size();
                par1.setInteger("atomsListSize", this.atomsListSize);
-               //System.out.println();
        }
 
        @Override
@@ -131,7 +124,7 @@ public class TileEntityChemicalCombinationTable extends TileEntity {
                                int id = data.readInt();
                                int size = data.readByte();
                                int damage = data.readInt();
-                               if(id != 0 && size != 0){
+                               if (id != 0 && size != 0){
                                        this.invm.setInventorySlotContents(i, new ItemStack(id, size, damage));
                                }else{
                                        this.invm.setInventorySlotContents(i, null);
@@ -142,7 +135,7 @@ public class TileEntityChemicalCombinationTable extends TileEntity {
                                int id = data.readInt();
                                int size = data.readByte();
                                int damage = data.readInt();
-                               if(id != 0 && size != 0){
+                               if (id != 0 && size != 0){
                                        this.invr.setInventorySlotContents(i, new ItemStack(id, size, damage));
                                }else{
                                        this.invr.setInventorySlotContents(i, null);
@@ -158,6 +151,12 @@ public class TileEntityChemicalCombinationTable extends TileEntity {
                        for(int i = 0;i < this.atomsListSize;i++){
                                this.atomsAmountList.add(data.readInt());
                        }
+
+                       ItemStack itemstack = new ItemStack(data.readInt(), data.readByte(), data.readInt());
+                       if(itemstack.itemID != 0 && !this.worldObj.isRemote){
+                               this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.xCoord, this.yCoord, this.zCoord, itemstack));
+                       }
+                       this.dropItems = null;
                } catch (Exception e) {
                        e.printStackTrace();
                }
@@ -170,7 +169,7 @@ public class TileEntityChemicalCombinationTable extends TileEntity {
                                int size = 0;
                                int damage  = 0;
                                ItemStack itemstack = this.invm.getStackInSlot(i);
-                               if(itemstack != null){
+                               if (itemstack != null){
                                        id = itemstack.itemID;
                                        size = itemstack.stackSize;
                                        damage = itemstack.getItemDamage();
@@ -189,7 +188,7 @@ public class TileEntityChemicalCombinationTable extends TileEntity {
                                int size = 0;
                                int damage  = 0;
                                ItemStack itemstack = this.invr.getStackInSlot(i);
-                               if(itemstack != null){
+                               if (itemstack != null){
                                        id = itemstack.itemID;
                                        size = itemstack.stackSize;
                                        damage = itemstack.getItemDamage();
@@ -210,6 +209,20 @@ public class TileEntityChemicalCombinationTable extends TileEntity {
                        for(int i = 0;i < this.atomsAmountList.size();i++){
                                dos.writeInt(this.atomsAmountList.get(i));
                        }
+
+                       if (this.dropItems != null){
+                               int id = this.dropItems.itemID;
+                               int size = this.dropItems.stackSize;
+                               int damage = this.dropItems.getItemDamage();
+                               dos.writeInt(id);
+                               dos.writeByte(size);
+                               dos.writeInt(damage);
+                       }else{
+                               dos.writeInt(0);
+                               dos.writeByte(0);
+                               dos.writeInt(0);
+                       }
+                       this.dropItems = null;
                } catch (Exception e) {
                        e.printStackTrace();
                }
@@ -217,7 +230,7 @@ public class TileEntityChemicalCombinationTable extends TileEntity {
 
        @SideOnly(Side.CLIENT)
        public void setAtoms(String par1, int par2){
-               if(this.atomsList.indexOf(par1) != -1){
+               if (this.atomsList.indexOf(par1) != -1){
                        int var1 = this.atomsList.indexOf(par1);
                        this.atomsAmountList.set(var1, this.atomsAmountList.get(var1) + par2);
                }else{
@@ -227,10 +240,14 @@ public class TileEntityChemicalCombinationTable extends TileEntity {
                PacketDispatcher.sendPacketToServer(this.getDescriptionPacket());
        }
 
+       public void setDropItems(ItemStack par1ItemStack){
+               this.dropItems = par1ItemStack;
+       }
+
        public String getAtoms(){
                StringBuffer var1 = new StringBuffer();
                for(int i = 0;i < this.atomsList.size();i++){
-                       if(this.atomsAmountList.get(i) != 1){
+                       if (this.atomsAmountList.get(i) != 1){
                                var1.append(this.atomsList.get(i) + this.atomsAmountList.get(i));
                        }else{
                                var1.append(this.atomsList.get(i));
@@ -247,7 +264,11 @@ public class TileEntityChemicalCombinationTable extends TileEntity {
                return this.atomsAmountList;
        }
 
-       @SuppressWarnings("unused")
+       public void emptytoAtomsList(){
+               this.atomsList.clear();
+               this.atomsAmountList.clear();
+       }
+
        protected boolean isNumber(String par1){
                try {
                        int var1 = Integer.valueOf(new String(par1));
diff --git a/common/chemicraft/util/CompaeatorFormulaPart.java b/common/chemicraft/util/CompaeatorFormulaPart.java
new file mode 100644 (file)
index 0000000..422bb23
--- /dev/null
@@ -0,0 +1,28 @@
+package chemicraft.util;
+
+import java.util.Arrays;
+import java.util.Comparator;
+
+public class CompaeatorFormulaPart implements Comparator<FormulaPart> {
+
+       @Override
+       public int compare(FormulaPart o1, FormulaPart o2) {
+               int i = 0;
+               byte[] var1Byte = o1.getAtom().getBytes();
+               byte[] var2Byte = o2.getAtom().getBytes();
+               while (var1Byte.length < i && var2Byte.length < i) {
+                       if (var1Byte[i] == var2Byte[i]) {
+                               i++;
+                               continue;
+                       }
+                       if (var1Byte[i] < var2Byte[i]) {
+                               return -1;
+                       }
+                       if (var1Byte[i] > var2Byte[i]) {
+                               return 1;
+                       }
+               }
+               return 0;
+       }
+
+}
diff --git a/common/chemicraft/util/FormulaPart.java b/common/chemicraft/util/FormulaPart.java
new file mode 100644 (file)
index 0000000..1786cd4
--- /dev/null
@@ -0,0 +1,34 @@
+package chemicraft.util;
+
+public class FormulaPart {
+
+       private String atom;
+       private int amount;
+
+       public FormulaPart(String par1, int par2){
+               this.atom = par1;
+               this.amount = par2;
+       }
+
+       public String getAtom(){
+               return this.atom;
+       }
+
+       public int getAmount(){
+               return this.amount;
+       }
+
+       @Override
+       public boolean equals(Object par1) {
+               try {
+                       FormulaPart var1 = (FormulaPart)par1;
+                       if (var1.atom.equals(this.atom) && var1.amount == this.amount) {
+                               return true;
+                       }
+               } catch (ClassCastException e) {
+                       return false;
+               }
+               return false;
+       }
+
+}