Jump to content

Recommended Posts

Posted

I am very new to Java and I wanted to learn how to code armor to give potion effects to the player when worn.

The armor itself is already implemented, the giving potion effects part is the only thing missing because I do not know how.

Posted
3 hours ago, diesieben07 said:

Subscribe to LivingEquipmentChangeEvent. Check if they are now wearing your armor (and weren't before) and add the potion effects. Check if they are now not wearing your armor (and were before) and remove the potion effects.

Can you give an example? I'm not that familiar how to code this

  • 1 month later...
Posted
1 hour ago, SovereignRed said:

I did this by overriding onArmorTick and adding the potion effect there, is that incorrect?

first this is not your thread, create next time your own

itself it would work, you then only give the player the effect for the next tick,
if you then use the night vision potion for example, the view is very strange because the potion kind of fades away and you do not have the achieved effect,
test it out and you will see whats happen

At the LivingEquipmentChangeEvent you give the player an infinite effect,
and you remove it if the player takes the item from the armor slot
 

that would be the most plausible explanation for me, correct me if something is wrong😀

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.