OSDN Git Service

Merge branch 'master' of https://scm.sourceforge.jp/gitroot/chemicraft/chemicraft
authorponkotate <ponkotate@users.sourceforge.jp>
Sat, 29 Dec 2012 02:55:38 +0000 (11:55 +0900)
committerponkotate <ponkotate@users.sourceforge.jp>
Sat, 29 Dec 2012 02:55:38 +0000 (11:55 +0900)
1  2 
common/chemicraft/ChemiCraft.java
common/chemicraft/item/ItemGasCollectingBottle.java
common/chemicraft/util/AtomInfo.java

@@@ -7,11 -7,32 +7,32 @@@ import net.minecraft.src.ItemStack
  import net.minecraft.src.Material;\r
  import net.minecraftforge.common.Configuration;\r
  import net.minecraftforge.common.Property;\r
- import chemicraft.Auxiliary.NameAuxiliary;\r
+ import chemicraft.block.BlockChemicalCombinationTable;\r
+ import chemicraft.block.BlockDecompositionTable;\r
+ import chemicraft.block.BlockMaterialCraftingTable;\r
+ import chemicraft.block.BlockToolAndMaterialCraftingTable;\r
+ import chemicraft.debug.CommandDeleteItem;\r
+ import chemicraft.debug.CommandSetTile;\r
+ import chemicraft.debug.CompoundHandlerTest;\r
+ import chemicraft.item.ItemAtomGrenade;\r
+ import chemicraft.item.ItemAtoms;\r
+ import chemicraft.item.ItemCompounds;\r
+ import chemicraft.item.ItemGasCollectingBottle;\r
+ import chemicraft.system.CommonProxy;\r
+ import chemicraft.system.PacketHandler;\r
+ import chemicraft.tileentity.TileEntityChemicalCombinationTable;\r
+ import chemicraft.tileentity.TileEntityDecompositionTable;\r
+ import chemicraft.tileentity.TileEntityMaterialCraftingTable;\r
+ import chemicraft.tileentity.TileEntityToolAndWeaponCraftingTable;\r
+ import chemicraft.util.Auxiliary;\r
+ import chemicraft.util.Auxiliary.NameAuxiliary;\r
+ import chemicraft.util.CreativeTabAtoms;\r
+ import chemicraft.util.NBTRecipeGrenade;\r
  import cpw.mods.fml.common.Mod;\r
  import cpw.mods.fml.common.SidedProxy;\r
  import cpw.mods.fml.common.event.FMLPostInitializationEvent;\r
  import cpw.mods.fml.common.event.FMLPreInitializationEvent;\r
+ import cpw.mods.fml.common.event.FMLServerStartingEvent;\r
  import cpw.mods.fml.common.network.NetworkMod;\r
  import cpw.mods.fml.common.network.NetworkRegistry;\r
  import cpw.mods.fml.common.registry.GameRegistry;\r
@@@ -159,6 -180,11 +180,11 @@@ public class ChemiCraft 
                proxy.registerRenderInformation();\r
        }\r
  \r
+       @Mod.ServerStarting\r
+       public void serverStarting(FMLServerStartingEvent event){\r
+               event.registerServerCommand(new CommandSetTile());\r
+               event.registerServerCommand(new CommandDeleteItem());\r
+       }\r
  \r
        @Mod.PostInit\r
        public void chemiPostLoadMethod(FMLPostInitializationEvent event) {\r
        }\r
  \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
                        new Character('A'), new ItemStack(this.itemAtoms, 1, 0),\r
                });\r
  \r
 +              // 化合物を追加します\r
 +              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
 +\r
                //手榴弾の追加\r
                ChemiCraftAPI.instance.addMaterialRecipe(new ItemStack[]{new ItemStack(Item.gunpowder)}, new ItemStack(this.itemAtomGrenade, 16, 0), new NBTRecipeGrenade());\r
  \r
@@@ -1,11 -1,11 +1,12 @@@
- package chemicraft;
+ package chemicraft.item;
  
- import java.util.Random;
- import net.minecraft.src.*;
+ import net.minecraft.src.EntityPlayer;
+ import net.minecraft.src.ItemStack;
+ import net.minecraft.src.World;
+ import chemicraft.ChemiCraft;
  
 -public class ItemGasCollectingBottle extends ItemAtomInfoContainer {
 +public class ItemGasCollectingBottle extends ItemAtomInfoContainer
 +{
  
        public ItemGasCollectingBottle(int id) {
                super(id);
        }
  
        @Override
 -      public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer){
 +      public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
 +      {
                par1ItemStack.damageItem(1, par3EntityPlayer);
  
                this.atomInfo.update(par2World, par3EntityPlayer);
 -              if(this.atomInfo.isBelowY(129)){
 -            if (!par3EntityPlayer.inventory.addItemStackToInventory(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 7)))
 -            {
 -                par3EntityPlayer.dropPlayerItem(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 7));
 -            }
 -              }
  
 +              int heightValue = par2World.getHeightValue((int) par3EntityPlayer.posX, (int) par3EntityPlayer.posZ);
 +
 +              int result1 = MathHelperPlus.instance.Probability(99, 1);
 +              int result2 = MathHelperPlus.instance.Probability(78, 21, 1);
 +              int result3 = MathHelperPlus.instance.Probability(0.032, 0.0018, 0.000012, 0.00052);
 +              if (this.atomInfo.isOverY(heightValue)) {
 +                      if (result1 == 0) {
 +                              if (result2 == 0) {
 +                                      this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 6), par3EntityPlayer);
 +                              } else if (result2 == 1) {
 +                                      this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 7), par3EntityPlayer);
 +                              } else {
 +                                      this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 17), par3EntityPlayer);
 +                              }
 +                      } else {
 +                              if (result3 == 0) {
 +                                      this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, 0), par3EntityPlayer);
 +                              } else if (result3 == 1) {
 +                                      this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 9), par3EntityPlayer);
 +                              } else if (result3 == 2) {
 +                                      this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, 1), par3EntityPlayer);
 +                              } else {
 +                                      this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 1), par3EntityPlayer);
 +                              }
 +                      }
 +              }
 +              if (par2World.isRemote) {
 +                      par3EntityPlayer.addChatMessage("result1=" + result1 + " result2=" + result2 + " result3=" + result3);
 +              }
                return par1ItemStack;
        }
  
 +      public void isStackOrDrop(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer)
 +      {
 +              if (!par2EntityPlayer.inventory.addItemStackToInventory(par1ItemStack)) {
 +                      par2EntityPlayer.dropPlayerItem(par1ItemStack);
 +              }
 +      }
 +
        @Override
 -      public String getTextureFile() {
 +      public String getTextureFile()
 +      {
                return "/chemicraft/items/items.png";
        }
  
@@@ -1,9 -1,6 +1,8 @@@
- package chemicraft;\r
+ package chemicraft.util;\r
  \r
 +import cpw.mods.fml.common.Side;\r
 +import cpw.mods.fml.common.asm.SideOnly;\r
  import net.minecraft.src.EntityPlayer;\r
- import net.minecraft.src.ItemStack;\r
  import net.minecraft.src.World;\r
  \r
  /**\r
@@@ -119,7 -116,6 +118,7 @@@ public class AtomInfo 
         * @param par1\r
         * @return 指定されたY軸より高いか\r
         */\r
 +      @SideOnly(Side.CLIENT)\r
        public boolean isOverY(int par1){\r
                if(this.posY >= par1){\r
                        return true;\r
         * @param par1\r
         * @return 指定されたY軸と同等かどうか\r
         */\r
 +      @SideOnly(Side.CLIENT)\r
        public boolean isEquivalentY(int par1){\r
                if(this.posY == par1){\r
                        return true;\r
         * @param par1\r
         * @return 指定されたY軸より低いか\r
         */\r
 +      @SideOnly(Side.CLIENT)\r
        public boolean isBelowY(int par1){\r
                if(this.posY <= par1){\r
                        return true;\r