Get player attack cooldown.

Started by Electroman on

Topic category: Help with Minecraft modding (Java Edition)

Joined May 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Get player attack cooldown.

Is there a procedure/dependency by which I can know if the player's attack is fully charged? I'm adding some sword enchantments but I want it to trigger only when the sword is at full strength, not every time I hit it. 

Joined Aug 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I figured it out.   Add this…
Tue, 03/11/2025 - 00:34

I figured it out.

 

Add this as a custom code snippet (and make sure the player class is imported):

(sourceentity instanceof Player _plr ? _plr.getAttackStrengthScale(0.5F) : .9) > 0.9F