OSDN Git Service

いろいろなバグを修正
authormozipi <mozipi@users.sourceforge.jp>
Sat, 29 Dec 2012 10:51:58 +0000 (19:51 +0900)
committermozipi <mozipi@users.sourceforge.jp>
Sat, 29 Dec 2012 10:51:58 +0000 (19:51 +0900)
common/chemicraft/ChemiCraft.java
common/chemicraft/ChemiCraftAPI.java
common/chemicraft/container/ContainerChemicalCombinationTable.java
common/chemicraft/system/ChemiCraftCraftingManager.java

index db86a69..f390430 100644 (file)
@@ -142,6 +142,8 @@ public class ChemiCraft {
        public NameAuxiliary nameAuxiliary = auxiliary.new NameAuxiliary();\r
        public ArrayAuxiliary arrayAuxiliary = auxiliary.new ArrayAuxiliary();\r
 \r
+       private ChemiCraftAPI api = ChemiCraftAPI.instance;\r
+\r
        @Mod.PreInit\r
        public void chemiPreLoadMethod(FMLPreInitializationEvent event) {\r
                Configuration cfg = new Configuration(event.getSuggestedConfigurationFile());\r
@@ -196,10 +198,6 @@ public class ChemiCraft {
 \r
        private void settingProcessing(FMLPostInitializationEvent event){\r
 \r
-               ChemiCraftAPI.instance.addCompound("Test");\r
-               ChemiCraftAPI.instance.addCompound("Test2");\r
-               ChemiCraftAPI.instance.settingCompoundHandler("Test", new CompoundHandlerTest());\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
@@ -291,7 +289,7 @@ public class ChemiCraft {
                ChemiCraftAPI.instance.addLangCompound("ja_JP", "CarbonDioxide", "二酸化炭素");\r
 \r
                // 化合物のレシピを追加します\r
-               ChemiCraftAPI.instance.addChemicalCombinationRecipe(new ItemStack[]{new ItemStack(this.itemAtoms, 5), new ItemStack(this.itemAtoms, 7)}, new ItemStack(this.itemCompounds, 0));\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
 \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
index 4ab1572..e265a09 100644 (file)
@@ -116,6 +116,17 @@ public class ChemiCraftAPI {
 
 
 
+       public int getDamageByName(String englishName){
+               for(int i = 0;i < compoundsNameList.size();i++){
+                       if(englishName.equals(compoundsNameList.get(i))){
+                               return i;
+                       }
+               }
+               return -1;
+       }
+
+
+
        /**
         * setting compound handler.
         * @param handlerItemName
index d322a07..68a2cc4 100644 (file)
@@ -106,9 +106,10 @@ public class ContainerChemicalCombinationTable extends Container {
        {
                super.slotClick(par1, par2, par3, par4EntityPlayer);
                if(par1 == 16){
+                       if(this.inv.getStackInSlot(16) == null) return super.slotClick(par1, par2, par3, par4EntityPlayer);
                        for(int i = 0;i < 16;i++){
                                if(this.inv.getStackInSlot(i) != null){
-                                       if(this.inv.getStackInSlot(i).stackSize >= 1){
+                                       if(this.inv.getStackInSlot(i).stackSize > 1){
                                                this.putStackInSlot(i, new ItemStack(this.inv.getStackInSlot(i).itemID, --this.inv.getStackInSlot(i).stackSize, this.inv.getStackInSlot(i).getItemDamage()));
                                        }else{
                                                this.putStackInSlot(i, null);
index a9dbf13..903c7f3 100644 (file)
@@ -98,23 +98,25 @@ public class ChemiCraftCraftingManager {
                        }
 
                        //trimToSize & sorting.
-                       materialID.trimToSize();
-                       materialDamage.trimToSize();
-                       recipeID.trimToSize();
-                       recipeDamage.trimToSize();
                        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++){
-                               //ID check.
-                               if(materialID.get(j) != recipeID.get(j)){ match = false;}
-                               //Damage check.
-                               if(materialDamage.get(j) != recipeDamage.get(j)){ match = false;}
+                               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 "match == true"