Help with Attributes/Anyone now how to get an player's current Armor Toughness?

Started by Rikurob on

Topic category: Help with modding (Java Edition)

Last seen on 06:22, 13. Mar 2023
Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Help with Attributes/Anyone now how to get an player's current Armor Toughness?

I could use some help getting the player's armor toughness value. I tried:

double armorToughness = (entity.getAttribute(Attributes.ARMOR_TOUGHNESS).getBaseValue());

And a few other things, but can't seem to get the value to call anything but 0. Is there a reason for this?

Last seen on 13:54, 28. Apr 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm pretty sure there's a…
Mon, 08/22/2022 - 14:58

I'm pretty sure there's a code block in the latest version to detect armor toughness. You could also just manually create a procedure that returns a value based on the specific armor items the player is wearing, (though it wouldn't be compatible with other mods.) Not sure if you can actually edit armor toughness though.

Last seen on 06:22, 13. Mar 2023
Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I am not trying to edit it I…
Mon, 08/22/2022 - 18:23

I am not trying to edit it I am trying to get the value in code, and you acually could modify it but its tricky. Thank you I will look into the new update.

Last seen on 06:22, 13. Mar 2023
Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Don't see it. I mostly meant…
Mon, 08/22/2022 - 18:28

Don't see it. I mostly meant if anyone knows the actual java code as there isn't a procedure for that and the plugin for it doesn't work with armor toughness

Last seen on 06:22, 13. Mar 2023
Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
For anyone else that needs…
Tue, 08/23/2022 - 21:31

For anyone else that needs this use this instead and it works, simple change.

double armorToughness = (entity.getAttribute(Attributes.ARMOR_TOUGHNESS).getValue());