Advertisement
CrushedPixel

Minecraft Attack Speed Regulation

Apr 21st, 2015
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. Minecraft Attack Speed Regulation System by CrushedPixel
  2. ========================================================
  3.  
  4. To set up the attack speed regulation, you need to create 4 Scoreboard Objectives:
  5.  
  6. /scoreboard objectives add attacked stat.damageDealt
  7. /scoreboard objectives add attackCD dummy
  8. /scoreboard objectives add cooldownValue dummy
  9. /scoreboard objectives add armSwing dummy
  10.  
  11. Then, put the following commands (in that execution order!) on a fill clock:
  12.  
  13. /scoreboard players set @a[score_attacked_min=1] armSwing 0
  14. /scoreboard players add @a[score_armSwing=9] armSwing 1
  15. /scoreboard players remove @a[score_attackCD_min=1] attackCD 1
  16. /execute @a[score_attacked_min=1] ~ ~ ~ /scoreboard players operation @p attackCD = @p cooldownValue
  17. /effect @a[score_attackCD_min=1] minecraft:weakness 10 100 true
  18. /effect @a[score_armSwing_min=10] minecraft:haste 10 10 true
  19. /effect @a[score_armSwing_min=10] minecraft:mining_fatigue 10 10 true
  20. /effect @a[score_attackCD=0] minecraft:mining_fatigue 0
  21. /effect @a[score_attackCD=0] minecraft:haste 0
  22. /effect @a[score_attackCD=0] minecraft:weakness 0
  23. /scoreboard players set @a attacked 0
  24.  
  25. How to use:
  26. Simply set the cooldownValue score for a player to a specific value, and after hurting a mob or player he will have to wait
  27. [cooldownValue] ticks until he can hit again.
  28.  
  29. Please note that this method of regulating a player's attack speed makes him unable to mine any blocks. This is required to create the visual effect of the player not swinging his weapon when clicking (which is done using weakness and haste effects).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement