public int atomsID;\r
public int compoundsID;\r
public int gasCollectingBottleID;\r
+ public int grenadeID;\r
\r
/**\r
* BlockID\r
public static Item itemAtoms;\r
public static Item itemCompounds;\r
public static Item itemGasCollectingBottle;\r
+ public static Item itemGrenade;\r
\r
/**\r
* このmodで使用するTextureのパス\r
*/\r
public String itemAtomsTexture = "/chemicraft/items/Atoms.png";\r
public String itemCompoundsTexture = "/chemicraft/items/Compounds.png";\r
+ public String itemTexture = "/chemicraft/items/items.png";\r
public String blockChemicalCraftingTableTexture = "/chemicraft/blocks/CCTable.png";\r
public String guiDecompositionTexture = "/chemicraft/guis/Decomposition.png";\r
public String guiChemicalCombinationTexture = "/chemicraft/guis/ChemicalCombination.png";\r
Property atomsIDProp = cfg.getItem("AtomsID", 25000);\r
Property compoundsIDProp = cfg.getItem("CompoundsID", 25001);\r
Property gasCollectingBottleIDProp = cfg.getItem("gasCollectingBottleID", 25002);\r
+ Property grenadeIDProp = cfg.getItem("GrenadeID0", 25003);\r
\r
Property guiDecompositionTableIDProp = cfg.get("GUI", "GUIChemicalCraftingTableID", 1000);\r
Property guiChemicalCombinationTableIDProp = cfg.get("GUI", "GUIChemicalCombinationTableID", 1001);\r
this.atomsID = atomsIDProp.getInt();\r
this.compoundsID = compoundsIDProp.getInt();\r
this.gasCollectingBottleID = gasCollectingBottleIDProp.getInt();\r
+ this.grenadeID = grenadeIDProp.getInt();\r
this.guiDecompositionTableID = guiDecompositionTableIDProp.getInt();\r
this.guiChemicalCombinationTableID = guiChemicalCombinationTableIDProp.getInt();\r
this.guiToolAndWeaponCraftingTableID = guiToolAndWeaponCraftingTableIDProp.getInt();\r
// Itemを追加します\r
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");\r
+ this.itemGasCollectingBottle = new ItemGasCollectingBottle(this.gasCollectingBottleID).setItemName("gasCollectingBottle").setIconIndex(0);\r
+ this.itemGrenade = new ItemGrenade(this.grenadeID).setItemName("grenade").setIconIndex(1);\r
\r
// BlockをMinecraftに登録します\r
GameRegistry.registerBlock(this.blockDecompositionTable);\r
this.NameAuxiliary.addName(this.itemAtoms, "ja_JP", atomsNameJP);\r
this.NameAuxiliary.addName(this.itemGasCollectingBottle, "GasCollectingBottle");\r
this.NameAuxiliary.addName(this.itemGasCollectingBottle, "ja_JP", "集気瓶");\r
+ this.NameAuxiliary.addName(this.itemGrenade, "Grenade");\r
+ this.NameAuxiliary.addName(this.itemGrenade, "手榴弾");\r
\r
// TileEntityを追加します\r
GameRegistry.registerTileEntity(TileEntityDecompositionTable.class, "DecompositionTable");\r
//Textureをpreloadします\r
proxy.registerTextures();\r
\r
- ChemiCraftAPI.instance.addChemicalCombinationRecipe(new ItemStack[]{new ItemStack(Block.stone)}, new ItemStack(Block.dirt));\r
-\r
- ChemiCraftAPI.instance.addMaterialRecipe(new ItemStack[]{new ItemStack(Block.dirt)}, new ItemStack(Block.stone), new NBTRecipeGrenade());\r
+ ChemiCraftAPI.instance.addMaterialRecipe(new ItemStack[]{new ItemStack(Block.dirt)}, new ItemStack(this.itemGrenade), new NBTRecipeGrenade());\r
\r
}\r
\r
--- /dev/null
+package chemicraft;
+
+import java.util.List;
+
+import net.minecraft.src.Item;
+import net.minecraft.src.ItemStack;
+import net.minecraft.src.NBTTagCompound;
+import net.minecraft.src.NBTTagList;
+
+public class ItemGrenade extends Item {
+
+ protected ItemGrenade(int par1) {
+ super(par1);
+ }
+
+ @Override
+ public void addInformation(ItemStack par1ItemStack, List par2List) {
+ NBTTagList var1 = par1ItemStack.getTagCompound().getTagList("Effect");
+
+ for(int i = 0;i < 3;i++){
+ if(!((NBTTagCompound)var1.tagAt(0)).getString("GrenadeEffect" + i).equals("")){
+ par2List.add(
+ ((NBTTagCompound)var1.tagAt(0)).getString("GrenadeEffect" + i)
+ );
+ }
+ }
+ }
+
+ @Override
+ public String getTextureFile(){
+ return "/chemicraft/items/items.png";
+ }
+
+}
import net.minecraft.src.ItemStack;
import net.minecraft.src.NBTTagCompound;
+import net.minecraft.src.NBTTagList;
public class NBTRecipeGrenade extends NBTRecipe {
result.stackTagCompound = new NBTTagCompound();
}
+ if (!result.stackTagCompound.hasKey("Effect"))
+ {
+ result.stackTagCompound.setTag("Effect", new NBTTagList("Effect"));
+ }
+
+ NBTTagList tagList = (NBTTagList) result.getTagCompound().getTag("Effect");
+ NBTTagCompound tag = new NBTTagCompound();
+
for(int i = 0;i < materials.length;i++){
if(materials[i] != null){
if(materials[i].itemID-256 == ChemiCraft.instance.atomsID && materials[i].getItemDamage() == ChemiCraft.HYDROGEN){
- result.getTagCompound().setString("GrenadeEffect", "Hydrogen");
+ tag.setString("GrenadeEffect" + i, "Hydrogen");
useItems[i] = materials[i];
}
if(materials[i].itemID-256 == ChemiCraft.instance.atomsID && materials[i].getItemDamage() == ChemiCraft.CARBON){
- result.getTagCompound().setString("GrenadeEffect", "Carbon");
+ tag.setString("GrenadeEffect" + i, "Carbon");
useItems[i] = materials[i];
}
if(materials[i].itemID-256 == ChemiCraft.instance.atomsID && materials[i].getItemDamage() == ChemiCraft.URANIUM){
- result.getTagCompound().setString("GrenadeEffect", "Uranium");
+ tag.setString("GrenadeEffect" + i, "Uranium");
useItems[i] = materials[i];
}
}
}
+ tagList.appendTag(tag);
return useItems;
}