Posted April 18, 201411 yr I am currently working on an item that will poison an entity on hit and I'm not sure why everything I have tried has not worked. I am using this code at the moment, but it does not work: public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving) { par2EntityLiving.addPotionEffect(new PotionEffect(Potion.poison.id, 200, 1)); return true; Thanks for Any Help or Suggestions
April 18, 201411 yr From what I remember I don't think (hitEntity) is a valid method in whatever item you are using. Try putting @Override on the method - to ensure that method exists (and works).
April 19, 201411 yr From what I remember I don't think (hitEntity) is a valid method in whatever item you are using. Try putting @Override on the method - to ensure that method exists (and works). It is, but the OP got the wrong method signature! @OP: the two EntityLiving parameters should be EntityLivingBase parameters. hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) And as coolboy4531 suggested, always add @Override above methods you intend to override to avoid errors. Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! | mah twitter This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.
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.