Posted October 22, 20205 yr 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)
October 22, 20205 yr 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 October 22, 20205 yr by vemerion
October 22, 20205 yr 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:
October 22, 20205 yr 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.