OSDN Git Service

「ItemAtomsGrenade」へ変名。
authorponkotate <ponkotate@users.sourceforge.jp>
Thu, 3 Jan 2013 14:06:45 +0000 (23:06 +0900)
committerponkotate <ponkotate@users.sourceforge.jp>
Thu, 3 Jan 2013 14:06:45 +0000 (23:06 +0900)
APIを修正。

common/chemicraft/ChemiCraft.java
common/chemicraft/ChemiCraftAPI.java
common/chemicraft/entity/EntityAtomsGrenade.java [moved from common/chemicraft/entity/EntityAtomGrenade.java with 92% similarity]
common/chemicraft/item/ItemAtomsGrenade.java [moved from common/chemicraft/item/ItemAtomGrenade.java with 84% similarity]
common/chemicraft/item/ItemGasCollectingBottle.java
common/chemicraft/render/RenderAtomsGrenade.java

index fa5465e..98ee592 100644 (file)
@@ -14,9 +14,9 @@ import chemicraft.block.BlockToolAndWeaponCraftingTable;
 import chemicraft.debug.CommandDeleteItem;\r
 import chemicraft.debug.CommandGenDebugRoom;\r
 import chemicraft.debug.CommandSetTile;\r
-import chemicraft.entity.EntityAtomGrenade;\r
-import chemicraft.item.ItemAtomGrenade;\r
+import chemicraft.entity.EntityAtomsGrenade;\r
 import chemicraft.item.ItemAtoms;\r
+import chemicraft.item.ItemAtomsGrenade;\r
 import chemicraft.item.ItemCompounds;\r
 import chemicraft.item.ItemGasCollectingBottle;\r
 import chemicraft.system.CommonProxy;\r
@@ -230,7 +230,7 @@ public class ChemiCraft {
                this.itemAtoms = new ItemAtoms(this.atomsID).setItemName("atoms");\r
                this.itemCompounds = new ItemCompounds(this.compoundsID).setItemName("compounds");\r
                this.itemGasCollectingBottle = new ItemGasCollectingBottle(this.gasCollectingBottleID).setItemName("gasCollectingBottle").setIconIndex(0);\r
-               this.itemAtomGrenade = new ItemAtomGrenade(this.atomGrenadeID).setItemName("grenade").setIconIndex(1);\r
+               this.itemAtomGrenade = new ItemAtomsGrenade(this.atomGrenadeID).setItemName("grenade").setIconIndex(1);\r
 \r
                // BlockをMinecraftに登録します\r
                GameRegistry.registerBlock(this.blockDecompositionTable);\r
@@ -270,8 +270,8 @@ public class ChemiCraft {
                proxy.registerTextures();\r
 \r
                //Entityを追加します\r
-               EntityRegistry.registerModEntity(EntityAtomGrenade.class, "EntityAtomGrenade", 1, this, 250, 5, false);\r
-               EntityRegistry.registerGlobalEntityID(EntityAtomGrenade.class, "EntityAtomGrenade", 220);\r
+               EntityRegistry.registerModEntity(EntityAtomsGrenade.class, "EntityAtomGrenade", 1, this, 250, 5, false);\r
+               EntityRegistry.registerGlobalEntityID(EntityAtomsGrenade.class, "EntityAtomGrenade", 220);\r
 \r
                //化学作業台類のレシピを追加します\r
                GameRegistry.addRecipe(new ItemStack(this.blockDecompositionTable),\r
@@ -311,6 +311,7 @@ public class ChemiCraft {
                ChemiCraftAPI.getInstance().addDecompositionRecipe(new ItemStack(Block.dirt), new ItemStack[]{new ItemStack(Block.stone)});\r
 \r
                // 化合物を追加します\r
+               ChemiCraftAPI.getInstance().addLangCompound("ja_JP", "CarbonMonoxide", "一酸化炭素");\r
                ChemiCraftAPI.getInstance().addLangCompound("ja_JP", "CarbonDioxide", "二酸化炭素");\r
 \r
                //手榴弾の追加\r
@@ -336,6 +337,7 @@ public class ChemiCraft {
                // API用の処理\r
                this.nameAuxiliary.addName(itemCompounds, ChemiCraftAPI.getInstance().getCompoundsName().toArray());\r
                this.nameAuxiliary.addName(itemCompounds, "ja_JP", ChemiCraftAPI.getInstance().getCompoundsLangName().toArray());\r
+               ChemiCraftAPI.getInstance().addCompoundHash(ChemiCraftAPI.getInstance().getCompoundsName().toArray());\r
        }\r
 \r
        private void debug(final FMLPostInitializationEvent event) {\r
index 330e1c0..ca54c3e 100644 (file)
@@ -131,7 +131,6 @@ public class ChemiCraftAPI {
        public int getDamageByName(String englishName){
                for(int i = 0;i < compoundsNameList.size();i++){
                        if(englishName.equals(compoundsNameList.get(i))){
-                               compoundHash.put(englishName, i);
                                return i;
                        }
                }
@@ -140,6 +139,22 @@ public class ChemiCraftAPI {
 
 
 
+       public void addCompoundHash(String key, int value){
+               compoundHash.put(key, value);
+       }
+
+
+
+       public void addCompoundHash(Object[] object){
+               for(int i = 0;i < compoundsNameList.size();i++){
+                       if(object[i].equals(compoundsNameList.get(i))){
+                               compoundHash.put((String) object[i], i);
+                       }
+               }
+       }
+
+
+
        public int getCompound(String key){
                if(compoundHash.get(key) != null){
                        return compoundHash.get(key);
@@ -10,7 +10,7 @@ import net.minecraft.src.MovingObjectPosition;
 import net.minecraft.src.PotionEffect;
 import net.minecraft.src.World;
 
-public class EntityAtomGrenade extends EntityThrowable
+public class EntityAtomsGrenade extends EntityThrowable
 {
 
        private float explodeSize;
@@ -18,7 +18,7 @@ public class EntityAtomGrenade extends EntityThrowable
        private boolean onFire;
        private boolean isNuke;
 
-       public EntityAtomGrenade(World par1World, EntityLiving par2EntityLiving, boolean par3, boolean par4, boolean par5) {
+       public EntityAtomsGrenade(World par1World, EntityLiving par2EntityLiving, boolean par3, boolean par4, boolean par5) {
                super(par1World, par2EntityLiving);
                this.isExplode = par3;
                this.onFire = par4;
similarity index 84%
rename from common/chemicraft/item/ItemAtomGrenade.java
rename to common/chemicraft/item/ItemAtomsGrenade.java
index 0d41fd1..7e6c43a 100644 (file)
@@ -2,20 +2,18 @@ package chemicraft.item;
 
 import java.util.List;
 
-import net.minecraft.src.Entity;
+import chemicraft.entity.EntityAtomsGrenade;
+
 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 {
+public class ItemAtomsGrenade extends Item {
 
-       public ItemAtomGrenade(int par1) {
+       public ItemAtomsGrenade(int par1) {
                super(par1);
        }
 
@@ -46,7 +44,7 @@ public class ItemAtomGrenade extends Item {
                                }
                        }
                }
-               EntityAtomGrenade entity = new EntityAtomGrenade(par2World, par3EntityPlayer, var1, var2, var3);
+               EntityAtomsGrenade entity = new EntityAtomsGrenade(par2World, par3EntityPlayer, var1, var2, var3);
                par2World.spawnEntityInWorld(entity);
                par1ItemStack.stackSize--;
                return par1ItemStack;
index 8f07fa6..49ef396 100644 (file)
@@ -71,10 +71,13 @@ public class ItemGasCollectingBottle extends ItemAtomInfoContainer
        @Override
        public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
        {
-               int var11 = par3World.getBlockId(par4, par5, par6);
-               Block block = Block.blocksList[var11];
+               int blockID = par3World.getBlockId(par4, par5, par6);
+               Block block = Block.blocksList[blockID];
 
-               if (block instanceof BlockFire){
+               int uniqueBlockID = par3World.getBlockId(par4, par5 + 1, par6);
+               Block uniqueBlock = Block.blocksList[uniqueBlockID];
+
+               if (uniqueBlock instanceof BlockFire){
                        par1ItemStack.damageItem(1, par2EntityPlayer);
 
                        int result1 = MathHelperPlus.probability(99, 1);
@@ -82,7 +85,7 @@ public class ItemGasCollectingBottle extends ItemAtomInfoContainer
                        if (result1 == 0) {
                                this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, ChemiCraftAPI.getInstance().getCompound("CarbonDioxide")), par2EntityPlayer);
                        } else {
-                               this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 17), par2EntityPlayer);
+                               this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, ChemiCraftAPI.getInstance().getCompound("CarbonMonoxide")), par2EntityPlayer);
                        }
 
                        return true;
index 38ee4f4..52d8815 100644 (file)
@@ -8,8 +8,11 @@ import org.lwjgl.opengl.GL11;
 import org.lwjgl.opengl.GL12;
 
 import chemicraft.ChemiCraft;
-import chemicraft.entity.EntityAtomGrenade;
+import chemicraft.entity.EntityAtomsGrenade;
+import cpw.mods.fml.common.Side;
+import cpw.mods.fml.common.asm.SideOnly;
 
+@SideOnly(Side.CLIENT)
 public class RenderAtomsGrenade extends Render {
 
        private float field_77002_a;
@@ -19,7 +22,7 @@ public class RenderAtomsGrenade extends Render {
                this.field_77002_a = par1;
        }
 
-       public void doRenderAtomsGrenade(EntityAtomGrenade par1AtomGrenade, double par2, double par4, double par6, float par8, float par9)
+       public void doRenderAtomsGrenade(EntityAtomsGrenade par1AtomGrenade, double par2, double par4, double par6, float par8, float par9)
        {
                GL11.glPushMatrix();
                GL11.glTranslatef((float)par2, (float)par4, (float)par6);
@@ -52,6 +55,6 @@ public class RenderAtomsGrenade extends Render {
        @Override
        public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
        {
-               this.doRenderAtomsGrenade((EntityAtomGrenade)par1Entity, par2, par4, par6, par8, par9);
+               this.doRenderAtomsGrenade((EntityAtomsGrenade)par1Entity, par2, par4, par6, par8, par9);
        }
 }