Check two armor pieces on player

Started by Ypermat on

Topic category: Help with modding (Java Edition)

Last seen on 10:28, 30. Oct 2023
Joined Aug 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Check two armor pieces on player
Tue, 02/14/2023 - 13:00 (edited)

Hello,

I a m working on a mod where wearing two pieces of armor of the same material gives you a buffs.

For example : two pieces of strenght armor gives you strenght and two pieces of luck armor gives you luck.
So with these four pieces you get strenght and luck.

I want to make a procedure that check what does the player have equipped. I know I can do that with "on player tick update".
But see here the procedure to check every possibility of having two pieces of the same armor for ONE armor :

Procedure
Procedure to check if the player have at least 2 pieces of the same armor type (Here "Strength Armor")

If I do that for like 5 different armors, the game will start to lag a lot. Imagine now with a lot of players. How can I make the game check only when the player Equip / Unequip ?

If I do it with "player uses item" I will need to check every piece of every armors, this is more OK I think but still a big check at every armor equip. And the player can also equip with the inventory HUD, dispensers, etc...

What do you think ? Is there a way to not harass the game with that ?

Edited by Ypermat on Tue, 02/14/2023 - 13:00
Last seen on 10:28, 30. Oct 2023
Joined Aug 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Figured it out myself..
Wed, 02/15/2023 - 16:18

Figured it out myself..