Detecting how much Damage a Player or Mob does to you

Started by CaiGuyCrafter on

Topic category: Help with modding (Java Edition)

Last seen on 04:47, 13. May 2024
Joined Dec 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Detecting how much Damage a Player or Mob does to you

Okay, so for my mod, I'm adding attributes. One of the attributes is Defense. No, it doesn't just upgrade a player's Max Health because I already have an attribute for that, but I want it to get/determine the damage that a mob or player would do to you in advance and subtract however many points of Defense you have off of the attack. Why would I need this, you ask? Well, in the mod, I've figured out how to make the player's health go above the standard 20 without effects, but the health cap is 1,024, and the Strength/Damage cap is much higher. Say you had 1,024 health, and an opponent (a player) had 500 or + Strength, that means you would get two or three shotted. So that's where defense comes into play, subtracting a certain amount of damage from the player's attack.

What I need to know is, with procedures or code, how would I decide how much damage that another player on Multiplayer, or even a mob would do before they attack you? And if it doesn't exist, can we get this feature? Cuz' that would be amazing!

Last seen on 04:47, 13. May 2024
Joined Dec 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Anyone? Thank you.
Fri, 06/11/2021 - 20:51

Anyone? Thank you.