Guest User

Minecraft 4 stage animation function

a guest
Mar 28th, 2022
558
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. # FOUR STAGE VALUE SWING
  2. # This code make "out" vary from max..0..-max..0 to create a 4 stage swing of values
  3. # The current timer is stored onto "@s"
  4. #
  5. # @s = timer counting from 0 to 4*max
  6. # in = maximum rotation / sequence number (max)
  7. # in1 = speed of sequencer
  8. # out = swing value to use
  9.  
  10. ## timeline (t) cycling
  11. scoreboard players operation #temp animation_4stage = in animation_4stage
  12. scoreboard players operation #temp animation_4stage *= #4 constant
  13. scoreboard players operation @s animation_4stage += in1 animation_4stage
  14. execute if score @s animation_4stage >= #temp animation_4stage run scoreboard players set @s animation_4stage 0
  15.  
  16. ## rotation calculations
  17. # get motion sequence
  18. scoreboard players operation #seq animation_4stage = @s animation_4stage
  19. scoreboard players operation #seq animation_4stage /= in animation_4stage
  20. # (t % in)
  21. scoreboard players operation #temp1 animation_4stage = @s animation_4stage
  22. scoreboard players operation #temp1 animation_4stage %= in animation_4stage
  23.  
  24. ## Sequence Output Calculation
  25. # seq = 0: 0 to max
  26. # seq = 1: max to 0
  27. # seq = 2: 0 to -max
  28. # seq = 3: -max to 0
  29.  
  30. # if seq = 1, 15 - (t % in)
  31. execute if score #seq animation_4stage matches 1 run scoreboard players operation #temp1 animation_4stage -= in animation_4stage
  32. execute if score #seq animation_4stage matches 1 run scoreboard players operation #temp1 animation_4stage *= #-1 constant
  33. # if seq = 2, - (t % in)
  34. execute if score #seq animation_4stage matches 2 run scoreboard players operation #temp1 animation_4stage *= #-1 constant
  35. # if seq = 3, - (t % in)
  36. execute if score #seq animation_4stage matches 3 run scoreboard players operation #temp1 animation_4stage -= in animation_4stage
  37.  
  38. scoreboard players operation out animation_4stage = #temp1 animation_4stage
Advertisement
Add Comment
Please, Sign In to add comment