Advertisement
zzTuras

Test

Jul 19th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.46 KB | None | 0 0
  1. t be too busy to post winners on the 8th of April, but any entries after the 7th of April at 11:59PM GMT will not be counted)
  2. #1 Apr 1, 2018
  3. Like Like x 3
  4. Donut
  5. Donut
  6. Addon Developer
  7. no addons and tested on dev32. the looping takes some time if the area selection is big so please be patient!
  8. Code (Skript):
  9. #Set point 1 command
  10. command /setpoint1:
  11. trigger:
  12. set {point1} to player's location
  13. send "&aPoint 1 has been set to your location."
  14.  
  15. #Set point 2 command
  16. command /setpoint2:
  17. trigger:
  18. set {point2} to player's location
  19. send "&aPoint 2 has been set to your location."
  20.  
  21. #Main command
  22. command /loopblocks:
  23. trigger:
  24. #Make sure everything is good to go before looping
  25. if {point1} is not set:
  26. send "&cPoint 1 has not been set."
  27. else if {point2} is not set:
  28. send "&cPoint 2 has not been set."
  29. else if {point1}'s world is not {point2}'s world:
  30. send "&cBoth points must be in the same world."
  31. else:
  32. send "&aLooping blocks... this will take a few moments, please be patient."
  33.  
  34. #Get min/max coords
  35. if x-coord of {point1} is greater than x-coord of {point2}:
  36. set {_minX} to x-coord of {point2}
  37. set {_maxX} to x-coord of {point1}
  38. else:
  39. set {_minX} to x-coord of {point1}
  40. set {_maxX} to x-coord of {point2}
  41. if y-coord of {point1} is greater than y-coord of {point2}:
  42. set {_minY} to y-coord of {point2}
  43. set {_maxY} to y-coord of {point1}
  44. else:
  45. set {_minY} to y-coord of {point1}
  46. set {_maxY} to y-coord of {point2}
  47. if z-coord of {point1} is greater than z-coord of {point2}:
  48. set {_minZ} to z-coord of {point2}
  49. set {_maxZ} to z-coord of {point1}
  50. else:
  51. set {_minZ} to z-coord of {point1}
  52. set {_maxZ} to z-coord of {point2}
  53.  
  54. #Loop the blocks
  55. set {_looping} to true
  56. set {_loopX} to {_minX}
  57. set {_loopY} to {_minY}
  58. set {_loopZ} to {_minZ}
  59. while {_looping} is true:
  60. add block at location at {_loopX}, {_loopY}, {_loopZ} to {_blocks::*}
  61. add 1 to {_loopX}
  62. if {_loopX} is greater than {_maxX}:
  63. set {_loopX} to {_minX}
  64. add 1 to {_loopY}
  65. if {_loopY} is greater than {_maxY}:
  66. set {_loopY} to {_minY}
  67. add 1 to {_loopZ}
  68. if {_loopZ} is greater than {_maxZ}:
  69. set {_looping} to false
  70. wait 1 tick
  71.  
  72. #Get a string containing all the block counts
  73. loop {_blocks::*}:
  74. set {_blockType} to "%loop-value%"
  75. add 1 to {_blockCount::%{_blockType}%}
  76. set {_allBlockCounts} to ""
  77. loop {_blockCount::*}:
  78. set {_allBlockCounts} to "%{_allBlockCounts}%%{_blockCount::%loop-index%}% %loop-index% | "
  79. set {_allBlockCounts} to the first (length of {_allBlockCounts} - 2) characters of {_allBlockCounts}
  80.  
  81. #Send results
  82. send "&aFinished!"
  83. send "&6Total number of blocks: &e%size of {_blocks::*}%"
  84. send "&6Block makeup: &e%{_allBlockCounts}%"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement