Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hello, I'm new in modding and I wanted to make it so that when putting on armor, the effect of potions was given, but all the lessons are for older versions of Minecraft and they do not work on 1.15.1
Could you help me, thanks in advance.

(I do not know English very well and therefore translated via Google Translate. Sorry If there are grammatical errors)

1 hour ago, nickname121341 said:

Hello, I'm new in modding and I wanted to make it so that when putting on armor, the effect of potions was given

You could listen to the LivingEquipmentChangeEvent event, check if the equipped armor is of a specific type, and if so apply the effect to the entity. Then you would also have to detect if the entity unequipped the armor, and if so remove the effect.

 

Alternatively, if the armor in question is your own mods custom armor, you could override onArmorTick() and periodically reapply the potion effect.

 

Here is a recent post (although for 1.16) discussing a similar issue: link

Edited by vemerion

  • Author
53 minutes ago, vemerion said:

You could listen to the LivingEquipmentChangeEvent event

I used LivingEquipmentChangeEvent and no errors were found in the code, but for some reason, when I put on the armor, minecraft crashes.
code:image.png.d9fc35bc3d3c555af764cb903f8646da.png

3 minutes ago, nickname121341 said:

I used LivingEquipmentChangeEvent and no errors were found in the code, but for some reason, when I put on the armor, minecraft crashes.

I would advise against copying code you don't fully understand, since it will most likely introduce bugs. First of all, remove 'value = Dist.CLIENT', since you cannot add potion effects on the client (I believe this was also discussed in the thread I linked).

 

Second, have you tried debugging / checking the logs to find out where and why it crashes? It is very hard for me to stare at a PNG of code trying to detect what 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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.