Hey,
I started picking up minecraft modding recently and I wanted to get a weapon to apply a potion effect when it hits an entity, I looked around in ItemSword and found "hitEntity" So I tried the following (here is the whole class)
public class ItemStoneSpear extends ItemSword{
public ItemStoneSpear(ToolMaterial p_i45356_1_) {
super(p_i45356_1_);
// TODO Auto-generated constructor stub
}
@Override
public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase){
par1ItemStack.damageItem(1, par3EntityLivingBase);
par2EntityLivingBase.addPotionEffect(new PotionEffect(Potion.poison.getId(),100 , 1));
return true;
}
}
But it doesn't work no matter what I try. So if someone could help me out i'd love it a ton