On Armor equipped and On Armor removed.

Started by StellaeLux on

Topic category: Help with MCreator software

Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
On Armor equipped and On Armor removed.
Fri, 09/27/2019 - 13:43 (edited)

I created 2 special armor sets. I simply want them to have a certain LOGIC NBT tag. When (an individual piece of) armor is equipped the NBT tag(of that specific piece) becomes true. When it is unequipped, it becomes false.

Currently there is no "on armor equipped" or "on armor removed" procedure call. There's only on (armor piece) update tick.

So setting the NBT tag to true is easy, though it hurts me on a spiritual level that it sets it to true 20 times per second, but setting it to false after when just unequipped is the harder part.

Does anyone have a clue on how to achieve this?

(EDIT: I added the procedure calls on the list https://mcreator.net/forum/53314/list-things-192)

Edited by StellaeLux on Fri, 09/27/2019 - 13:43
Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
APPROACH 1: for every armour…
Fri, 09/27/2019 - 13:54

APPROACH 1:

for every armour piece (in this example the helmet):

----------On Helmet Update Call:

Set Entity Number NBT tag "OnHelmetEquippedCounter" to 0.

Set Entity Logic NBT tag "OnHelmetEquipped" to true.

----------On Player Update:

If Get Entity Number NBT tag "OnHelmetEquippedCounter" < 3

Do Set Entity Number NBT tag "OnHelmetEquippedCounter" to Get Entity Number NBT tag 
"OnHelmetEquippedCounter" + 1.

If Get Entity Number NBT tag "OnHelmetEquippedCounter" > 2

Do Set Entity Logic NBT tag "OnHelmetEquipped" to false..

But this seems so so so inefficient. 20 ticks when wearing 1 of those armor pieces: 80 when wearing a whole set and 4 versions of the OnPlayerUpdate either always incrementing or setting a value to false every tick as well!

If you guys know something better please let me know.

Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You could do an if statement…
Sat, 09/28/2019 - 20:33

You could do an if statement to check if it's already set to true before setting it to true.

 

But this adds to the computational logic that it would have to do.

Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Getting the value and…
Sat, 09/28/2019 - 21:08

Getting the value and comparing it or simply setting the value. I don't know which one is more taxing. I really hope we gan an on armor equipped/on armor removed procedure call, just like the ones input slots in gui have.

Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
for the "Do Set Entity…
Fri, 11/15/2019 - 22:14

for the "Do Set Entity Number NBT tag "OnHelmetEquippedCounter" to Get Entity Number NBT tag "OnHelmetEquippedCounter" + 1." how do you add the +1

Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Inside the "Math" tab there…
Fri, 11/15/2019 - 22:30

Inside the "Math" tab there's the "... + ..." and the "0" which you can set to 1.

Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
yeah i got it now, i was…
Fri, 11/15/2019 - 22:34

yeah i got it now, i was confused on how to group it all up so you could put it in the DO procedure thing lol. Thanks!