Potion effect on right click

Started by stegy17 on Sun, 05/10/2015 - 15:45
Last seen on 00:17, 26. Nov 2015
Joined Dec 2014
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Potion effect on right click
Sun, 05/10/2015 - 15:45

I want to make an item that damages you then gives you a potion effect but since it's a tool adding a potion effect isn't in the premade settings, so can someone please tell me the custom code to put in the right click area to make it give you the strenght 2 potion effect for 1 minute? Thank you.

Last seen on 16:30, 22. May 2015
Joined May 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
public ItemStack
Tue, 05/19/2015 - 16:21
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entity){ float var4 = 1.0F; int i = (int)(entity.prevPosX + (entity.posX - entity.prevPosX) * (double)var4); int j = (int)(entity.prevPosY + (entity.posY - entity.prevPosY) * (double)var4 + 1.62D - (double)entity.yOffset); int k = (int)(entity.prevPosZ + (entity.posZ - entity.prevPosZ) * (double)var4);     if(true){ if(entity instanceof EntityLivingBase) ((EntityLivingBase)entity).addPotionEffect(new PotionEffect(1, 60, 1)); }   Help it worked ;D (PS: i don't made the damage effect jsut potion)
Last seen on 00:17, 26. Nov 2015
Joined Dec 2014
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
RE:public ItemStack
Fri, 05/22/2015 - 00:23

But where exactly do i put that code in the coding for an item.