OSDN Git Service

修正
authorponkotate <ponkotate@users.sourceforge.jp>
Mon, 11 Feb 2013 06:38:05 +0000 (15:38 +0900)
committerponkotate <ponkotate@users.sourceforge.jp>
Mon, 11 Feb 2013 06:38:05 +0000 (15:38 +0900)
・鉱石が集中して生成される不具合を修正
・確率用メソッド修正

common/pcc/chemicraft/ChemiCraft.java
common/pcc/chemicraft/gen/WorldGenAtomsOre.java
common/pcc/chemicraft/item/ItemGasCollectingBottle.java
common/pcc/chemicraft/util/Auxiliary.java

index c06acce..cfeb7ff 100644 (file)
@@ -317,7 +317,7 @@ public class ChemiCraft {
                });
 
                //鉱石を追加します
                });
 
                //鉱石を追加します
-               api.addAtomsOre(Block.blockDiamond.blockID, 0, 5, 20, 20); //テスト用。ダイヤモンドブロックを生成します
+               api.addAtomsOre(Block.blockDiamond.blockID, 0, 5, 5, 20); //テスト用。ダイヤモンドブロックを生成します
 
                //鉱石の生成
                for (int i = 0; i < api.getAtomsOreIDList().size(); i++) {
 
                //鉱石の生成
                for (int i = 0; i < api.getAtomsOreIDList().size(); i++) {
index fd190c6..ac66f54 100644 (file)
@@ -33,7 +33,7 @@ public class WorldGenAtomsOre extends WorldGenMinable implements IWorldGenerator
        public void generate(Random par1Random, int par2ChunkX, int par3ChunkZ, World par4World, IChunkProvider par5ChunkGenerator, IChunkProvider par6ChunkProvider)
        {
                for (int i = 0; i < this.frequency; i++) {
        public void generate(Random par1Random, int par2ChunkX, int par3ChunkZ, World par4World, IChunkProvider par5ChunkGenerator, IChunkProvider par6ChunkProvider)
        {
                for (int i = 0; i < this.frequency; i++) {
-                       this.generate(par4World, par1Random, par2ChunkX << 4, par1Random.nextInt(this.posY), par3ChunkZ << 4);
+                       this.generate(par4World, par1Random, par2ChunkX * 16 + par1Random.nextInt(16), par1Random.nextInt(this.posY), par3ChunkZ * 16 + par1Random.nextInt(16));
                }
        }
 
                }
        }
 
index 08f39e5..2e3d061 100644 (file)
@@ -55,11 +55,6 @@ public class ItemGasCollectingBottle extends ItemAtomInfoContainer
                        }
                }
 
                        }
                }
 
-               // デバッグ用
-               if (par2World.isRemote) {
-                       par3EntityPlayer.addChatMessage("result1=" + result1 + " result2=" + result2 + " result3=" + result3);
-               }
-
                return par1ItemStack;
        }
 
                return par1ItemStack;
        }
 
@@ -98,7 +93,7 @@ public class ItemGasCollectingBottle extends ItemAtomInfoContainer
        @Override
        public String getTextureFile()
        {
        @Override
        public String getTextureFile()
        {
-               return "/chemicraft/items/items.png";
+               return ChemiCraft.instance.ITEMTEXTURE;
        }
 
 }
        }
 
 }
index 2f0946a..a34db96 100644 (file)
@@ -203,11 +203,21 @@ public class Auxiliary {
                }
 
                public int getProbability(ArrayList<Double> par1){
                }
 
                public int getProbability(ArrayList<Double> par1){
+
+                       double var1 = 0;
+
                        for (int i = 0; i < par1.size(); i++){
                        for (int i = 0; i < par1.size(); i++){
-                               double var1 = par1.get(i) / 100;
-                               double var2 = Math.random();
-                               if (var1 <= var2){
-                                       return i;
+                               var1 += par1.get(i);
+                       }
+
+                       double var2 = 0;
+                       double var3 = Math.random();
+
+                       for (int j = 0; j < par1.size(); j++){
+                               double var4 = par1.get(j) / var1;
+                               var2 += var4;
+                               if (var2 >= var3){
+                                       return j;
                                }else{
                                        continue;
                                }
                                }else{
                                        continue;
                                }