Posted October 23, 201213 yr after update to forge 4.2.5 build 303, have a small problem, OK changing the ItemsSeeds to the new IPlantable, but now the ItemDamage not work. package betterworld.PlantsAndFood.common.items; import betterworld.PlantsAndFood.common.BetterWorldPlantsAndFood; import net.minecraft.src.Block; import net.minecraft.src.CreativeTabs; import net.minecraft.src.EntityLiving; import net.minecraft.src.EntityPlayer; import net.minecraft.src.Item; import net.minecraft.src.ItemStack; import net.minecraft.src.World; import net.minecraftforge.common.EnumPlantType; import net.minecraftforge.common.IPlantable; public class ItemSeedsBag extends Item implements IPlantable { private int blockType; private int soilBlockID1; private int soilBlockID2; public ItemSeedsBag(int par1, int par2, int par3, int texture) { super(par1); this.blockType = par2; this.soilBlockID1 = par3; this.setMaxDamage(32); setIconIndex(texture); this.setCreativeTab(CreativeTabs.tabMaterials); } public boolean tryPlaceIntoWorld(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { if (par7 != 1) { return false; } else if (par2EntityPlayer.canPlayerEdit(par4, par5, par6) && par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6)) { int var11 = par3World.getBlockId(par4, par5, par6); if (var11 == this.soilBlockID1 && par3World.isAirBlock(par4, par5 + 1, par6)) { par3World.setBlockWithNotify(par4, par5 + 1, par6, this.blockType); // --par1ItemStack.stackSize; par1ItemStack.damageItem(1, par2EntityPlayer); return true; } else { return false; } } else { return false; } } public String getTextureFile() { return "/betterworld/textures/PlantsAndFood/items.png"; } @Override public EnumPlantType getPlantType(World world, int x, int y, int z) { return (blockType == Block.netherStalk.blockID ? EnumPlantType.Nether : EnumPlantType.Crop); } @Override public int getPlantID(World world, int x, int y, int z) { return blockType; } @Override public int getPlantMetadata(World world, int x, int y, int z) { return 0; } } normaly use this: par1ItemStack.damageItem(1, par2EntityPlayer); There are more changes in 4.2.5?
October 23, 201213 yr If I understood correctly, you're making a seed bag that can be used a number of times, right? Maybe you have to override the "isDamageable" function to return true?
October 23, 201213 yr Author If I understood correctly, you're making a seed bag that can be used a number of times, right? Maybe you have to override the "isDamageable" function to return true? Thanks for the try, but not help. Found the Error in my old code i use: public boolean tryPlaceIntoWorld(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) only for seeds work but not more for ItemDamage. must change it to "onItemUse"
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.