Jump to content

Help with artifacts!


stalkermetro

Recommended Posts

I made artifact that restores health. Did it all in OnTickInGame. But when I remove the effect remains.

 

Code in OnTickInGame:

 


	if(mc.thePlayer.inventory.getStackInSlot(6 - 6) != null && mc.thePlayer.inventory.getStackInSlot(6 - 6).itemID == Items.artSoul.itemID )
	{
		mc.thePlayer.addPotionEffect(new PotionEffect(Potion.regeneration.id, 100, 0, true));

	}

Link to comment
Share on other sites

Wouldn't this add 100 ticks to the potion duration on every single tick? Thus making the effect last 100 times longer than however you had it equipped for? You should try having it check to see if the potion effect is already active before applying it again. Here's the code I used for one of my items:

 

if (!player.isPotionActive(Potion.jump))
        	 {
        	  player.addPotionEffect(new PotionEffect(Potion.jump.id, 500, 1));
        	 }

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.