From: ponkotate Date: Thu, 3 Jan 2013 14:11:55 +0000 (+0900) Subject: Merge branch 'master' of https://scm.sourceforge.jp/gitroot/chemicraft/chemicraft X-Git-Url: http://git.sourceforge.jp/view?p=chemicraft%2Fchemicraft.git;a=commitdiff_plain;h=6abdf76bb420b766478ef8eb56b25801bd50b0e9;hp=d719d8923bd1e1c22385eb3c147b4d274154b046 Merge branch 'master' of https://scm.sourceforge.jp/gitroot/chemicraft/chemicraft Conflicts: common/chemicraft/ChemiCraft.java common/chemicraft/item/ItemAtomsGrenade.java common/chemicraft/render/RenderAtomsGrenade.java --- diff --git a/common/chemicraft/ChemiCraft.java b/common/chemicraft/ChemiCraft.java index 2bd896c..fe7ebf5 100644 --- a/common/chemicraft/ChemiCraft.java +++ b/common/chemicraft/ChemiCraft.java @@ -18,6 +18,7 @@ import chemicraft.debug.CommandSetTile; import chemicraft.entity.EntityAtomsGrenade; import chemicraft.item.ItemAtomGrenade; import chemicraft.item.ItemAtoms; +import chemicraft.item.ItemAtomsGrenade; import chemicraft.item.ItemCompounds; import chemicraft.item.ItemGasCollectingBottle; import chemicraft.system.CommonProxy; @@ -228,7 +229,7 @@ public class ChemiCraft { this.itemAtoms = new ItemAtoms(this.atomsID).setItemName("atoms"); this.itemCompounds = new ItemCompounds(this.compoundsID).setItemName("compounds"); this.itemGasCollectingBottle = new ItemGasCollectingBottle(this.gasCollectingBottleID).setItemName("gasCollectingBottle").setIconIndex(0); - this.itemAtomGrenade = new ItemAtomGrenade(this.atomGrenadeID).setItemName("grenade").setIconIndex(1); + this.itemAtomGrenade = new ItemAtomsGrenade(this.atomGrenadeID).setItemName("grenade").setIconIndex(1); // BlockをMinecraftに登録します GameRegistry.registerBlock(this.blockDecompositionTable); @@ -301,6 +302,7 @@ public class ChemiCraft { }); // 化合物を追加します + ChemiCraftAPI.getInstance().addLangCompound("ja_JP", "CarbonMonoxide", "一酸化炭素"); ChemiCraftAPI.getInstance().addLangCompound("ja_JP", "CarbonDioxide", "二酸化炭素"); ChemiCraftAPI.getInstance().addLangCompound("ja_JP", "Water", "水"); @@ -329,6 +331,7 @@ public class ChemiCraft { // API用の処理 this.nameAuxiliary.addName(itemCompounds, ChemiCraftAPI.getInstance().getCompoundsName().toArray()); this.nameAuxiliary.addName(itemCompounds, "ja_JP", ChemiCraftAPI.getInstance().getCompoundsLangName().toArray()); + ChemiCraftAPI.getInstance().addCompoundHash(ChemiCraftAPI.getInstance().getCompoundsName().toArray()); } private void debug(final FMLPostInitializationEvent event) { diff --git a/common/chemicraft/ChemiCraftAPI.java b/common/chemicraft/ChemiCraftAPI.java index 330e1c0..ca54c3e 100644 --- a/common/chemicraft/ChemiCraftAPI.java +++ b/common/chemicraft/ChemiCraftAPI.java @@ -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); diff --git a/common/chemicraft/item/ItemAtomGrenade.java b/common/chemicraft/item/ItemAtomsGrenade.java similarity index 94% rename from common/chemicraft/item/ItemAtomGrenade.java rename to common/chemicraft/item/ItemAtomsGrenade.java index 06d31c3..1dcfda9 100644 --- a/common/chemicraft/item/ItemAtomGrenade.java +++ b/common/chemicraft/item/ItemAtomsGrenade.java @@ -2,7 +2,8 @@ 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; @@ -13,9 +14,9 @@ import net.minecraft.src.WorldClient; import net.minecraft.src.WorldServer; import chemicraft.entity.EntityAtomsGrenade; -public class ItemAtomGrenade extends Item { +public class ItemAtomsGrenade extends Item { - public ItemAtomGrenade(int par1) { + public ItemAtomsGrenade(int par1) { super(par1); } diff --git a/common/chemicraft/item/ItemGasCollectingBottle.java b/common/chemicraft/item/ItemGasCollectingBottle.java index 8f07fa6..49ef396 100644 --- a/common/chemicraft/item/ItemGasCollectingBottle.java +++ b/common/chemicraft/item/ItemGasCollectingBottle.java @@ -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; diff --git a/common/chemicraft/render/RenderAtomsGrenade.java b/common/chemicraft/render/RenderAtomsGrenade.java index 161f99e..52d8815 100644 --- a/common/chemicraft/render/RenderAtomsGrenade.java +++ b/common/chemicraft/render/RenderAtomsGrenade.java @@ -9,7 +9,10 @@ import org.lwjgl.opengl.GL12; import chemicraft.ChemiCraft; 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;