OSDN Git Service

修正
[chemicraft/chemicraft.git] / common / pcc / chemicraft / item / ItemGasCollectingBottle.java
index 1a59647..599c729 100644 (file)
@@ -7,16 +7,18 @@ import net.minecraft.item.ItemStack;
 import net.minecraft.world.World;
 import pcc.chemicraft.ChemiCraft;
 import pcc.chemicraft.ChemiCraftAPI;
-import pcc.chemicraft.util.MathHelperPlus;
+import pcc.chemicraft.util.Auxiliary.Probability;
 
 public class ItemGasCollectingBottle extends ItemAtomInfoContainer
 {
 
+       public Probability probability = new Probability();
+
        public ItemGasCollectingBottle(int id) {
                super(id);
                this.setMaxStackSize(1);
                this.setMaxDamage(2);
-               this.setCreativeTab(ChemiCraft.instance.creativeTab);
+               this.setCreativeTab(ChemiCraft.instance.creativeTabChemiCraft);
        }
 
        @Override
@@ -28,9 +30,9 @@ public class ItemGasCollectingBottle extends ItemAtomInfoContainer
 
                int heightValue = par2World.getHeightValue((int) par3EntityPlayer.posX, (int) par3EntityPlayer.posZ);
 
-               int result1 = MathHelperPlus.probability(99, 1);
-               int result2 = MathHelperPlus.probability(78, 21, 1);
-               int result3 = MathHelperPlus.probability(0.032, 0.0018, 0.000012, 0.00052);
+               int result1 = probability.getProbability(99.0D, 1.0D);
+               int result2 = probability.getProbability(78.0D, 21.0D, 1.0D);
+               int result3 = probability.getProbability(0.032D, 0.0018D, 0.000012D, 0.00052D);
                if (this.atomInfo.isOverY(heightValue)) {
                        if (result1 == 0) {
                                if (result2 == 0) {
@@ -42,7 +44,7 @@ public class ItemGasCollectingBottle extends ItemAtomInfoContainer
                                }
                        } else {
                                if (result3 == 0) {
-                                       this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, ChemiCraftAPI.getInstance().getCompound("CarbonDioxide")), par3EntityPlayer);
+                                       this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, ChemiCraftAPI.instance().getCompound("CarbonDioxide")), par3EntityPlayer);
                                } else if (result3 == 1) {
                                        this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 9), par3EntityPlayer);
                                } else if (result3 == 2) {
@@ -53,12 +55,6 @@ public class ItemGasCollectingBottle extends ItemAtomInfoContainer
                        }
                }
 
-               // デバッグ用
-               if (par2World.isRemote) {
-                       par3EntityPlayer.addChatMessage("result1=" + result1 + " result2=" + result2 + " result3=" + result3);
-                       par3EntityPlayer.addChatMessage("このメッセージは開発版のみの表示ですが、もし製品版で表示されていた場合はご連絡ください。");
-               }
-
                return par1ItemStack;
        }
 
@@ -81,12 +77,12 @@ public class ItemGasCollectingBottle extends ItemAtomInfoContainer
                if (uniqueBlock instanceof BlockFire){
                        par1ItemStack.damageItem(1, par2EntityPlayer);
 
-                       int result1 = MathHelperPlus.probability(90, 10);
+                       int result1 = probability.getProbability(99, 1);
 
                        if (result1 == 0) {
-                               this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, ChemiCraftAPI.getInstance().getCompound("CarbonDioxide")), par2EntityPlayer);
+                               this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, ChemiCraftAPI.instance().getCompound("CarbonDioxide")), par2EntityPlayer);
                        } else {
-                               this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, ChemiCraftAPI.getInstance().getCompound("CarbonMonoxide")), par2EntityPlayer);
+                               this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, ChemiCraftAPI.instance().getCompound("CarbonMonoxide")), par2EntityPlayer);
                        }
 
                        return true;
@@ -97,7 +93,7 @@ public class ItemGasCollectingBottle extends ItemAtomInfoContainer
        @Override
        public String getTextureFile()
        {
-               return "/chemicraft/items/items.png";
+               return ChemiCraft.instance.ITEM_TEXTURE;
        }
 
 }