Zeldaboy111

Quarry Reset! ]|[ Skript #326

Jul 5th, 2020
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.38 KB | None | 0 0
  1. #GUI when clicking on it
  2. options:
  3. logo: &9&lQuarry&8:&7
  4.  
  5. function checkQuarry(p: Player, loc: Location) :: boolean:
  6. set {_below} to block 1 meters below {_loc}
  7. if block at {_below} is not dropper:
  8. return false
  9. set {_detected} to false
  10. if block at location 1 meters north of {_below} is hopper:
  11. if block at location 1 meters south of {_below} is chest:
  12. if block at location 2 meters south of {_below} is chest:
  13. set {_detected} to true
  14. set {quarry.chestDetect.%{_loc}%} to south
  15. else if block at location 1 meters east of {_below} is hopper:
  16. if block at location 1 meters west of {_below} is chest:
  17. if block at location 2 meters west of {_below} is chest:
  18. set {_detected} to true
  19. set {quarry.chestDetect.%{_loc}%} to west
  20. else if block at location 1 meters south of {_below} is hopper:
  21. if block at location 1 meters north of {_below} is chest:
  22. if block at location 2 meters north of {_below} is chest:
  23. set {_detected} to true
  24. set {quarry.chestDetect.%{_loc}%} to north
  25. else if block at location 1 meters west of {_below} is hopper:
  26. if block at location 1 meters east of {_below} is chest:
  27. if block at location 2 meters east of {_below} is chest:
  28. set {_detected} to true
  29. set {quarry.chestDetect.%{_loc}%} to east
  30.  
  31. return {_detected}
  32.  
  33. function quarryGUI(p: Player, loc: Location):
  34. set {quarry.open.%{_p}%} to {_loc}
  35. open chest with 5 rows named "Quarry" to {_p}
  36. wait 2 ticks
  37. set {_count} to 45
  38. loop 9 times:
  39. set slot loop-value - 1 of {_p}'s current inventory to gray stained glass pane named "&8"
  40. set slot {_count} - loop-value of {_p}'s current inventory to gray stained glass pane named "&8"
  41.  
  42. loop 4 times:
  43. set slot 9*loop-value of {_p}'s current inventory to gray stained glass pane named "&8"
  44. set slot 9*loop-value - 1 of {_p}'s current inventory to gray stained glass pane named "&8"
  45.  
  46. #RESET SLOT
  47.  
  48. if {quarry.list.%{_loc}%.enabled} is true:
  49. set slot 21 of {_p}'s current inventory to lime shulker box named "&aEnabled"
  50. set slot 23 of {_p}'s current inventory to red shulker box named "&cDisable"
  51. set slot 31 of {_p}'s current inventory to note block named "&7Reset" with lore "" and "&8This cannot be undone!"
  52. else:
  53. set slot 21 of {_p}'s current inventory to lime shulker box named "&aEnable"
  54. set slot 23 of {_p}'s current inventory to red shulker box named "&cDisabled"
  55. set slot 31 of {_p}'s current inventory to note block named "&7Reset" with lore "" and "&8This cannot be undone!"
  56.  
  57. function mine(loc: Location, startLoc: Location):
  58. set {_mine} to true
  59. set {_chest} to block at {quarry.chest.%{_loc}%}
  60. if {quarry.row.%{_loc}%} is not set:
  61. set {quarry.row.%{_loc}%} to 0
  62. if {quarry.colmn.%{_loc}%} is not set:
  63. set {quarry.colmn.%{_loc}%} to 0
  64. if {quarry.depth.%{_loc}%} is not set:
  65. set {quarry.depth.%{_loc}%} to 0
  66. while {quarry.list.%{_loc}%.enabled}:
  67. broadcast "Run"
  68. #teleport ("Zeldaboy111" parsed as a player) to {quarry.current.%{_quarry}%}
  69. if {_mine}:
  70. wait 3 ticks
  71. #wait 7 seconds
  72. else:
  73. #wait 30 ticks
  74. wait 1 ticks
  75.  
  76. if {quarry.current.%{_loc}%} < 2:
  77. delete {quarry.list.%{_loc}%.enabled}
  78. stop
  79.  
  80. set {_mine} to false
  81. if {quarry.row.%{_loc}%} is not set:
  82. set {quarry.row.%{_loc}%} to 0
  83. if {quarry.colmn.%{_loc}%} is not set:
  84. set {quarry.colmn.%{_loc}%} to 0
  85. if {quarry.depth.%{_loc}%} is not set:
  86. set {quarry.depth.%{_loc}%} to 0
  87.  
  88. if {quarry.row.%{_loc}%} >= 6:
  89. set {quarry.row.%{_loc}%} to 0
  90. if {quarry.colmn.%{_loc}%} <= 4:
  91. add 1 to {quarry.colmn.%{_loc}%}
  92. if {quarry.chestDetect.%{_loc}%} is north:
  93. set {quarry.current.%{_loc}%} to location 1 meters east and 6 meters north of {quarry.current.%{_loc}%}
  94. else if {quarry.chestDetect.%{_loc}%} is east:
  95. set {quarry.current.%{_loc}%} to location 1 meters north and 6 meters east of {quarry.current.%{_loc}%}
  96. else if {quarry.chestDetect.%{_loc}%} is south:
  97. set {quarry.current.%{_loc}%} to location 1 meters west and 6 meters south of {quarry.current.%{_loc}%}
  98. else if {quarry.chestDetect.%{_loc}%} is west:
  99. set {quarry.current.%{_loc}%} to location 1 meters south and 6 meters west of {quarry.current.%{_loc}%}
  100.  
  101. else:
  102. set {quarry.colmn.%{_loc}%} to 0
  103. if y-coordinate of {quarry.current.%{_loc}%} > 0:
  104. add 1 to {quarry.depth.%{_loc}%}
  105. set {quarry.current.%{_loc}%} to location {quarry.depth.%{_loc}%} meters below {_startLoc}
  106. else:
  107. set {quarry.list.%{_loc}%.enabled} to false
  108. delete {quarry.current.%{_loc}%}
  109. #else:
  110. add 1 to {quarry.row.%{_loc}%}
  111. if {quarry.chestDetect.%{_loc}%} is north:
  112. set {quarry.current.%{_loc}%} to location 1 meters south of {quarry.current.%{_loc}%}
  113. else if {quarry.chestDetect.%{_loc}%} is east:
  114. set {quarry.current.%{_loc}%} to location 1 meters west of {quarry.current.%{_loc}%}
  115. else if {quarry.chestDetect.%{_loc}%} is south:
  116. set {quarry.current.%{_loc}%} to location 1 meters north of {quarry.current.%{_loc}%}
  117. else if {quarry.chestDetect.%{_loc}%} is west:
  118. set {quarry.current.%{_loc}%} to location 1 meters east of {quarry.current.%{_loc}%}
  119.  
  120. if checkQuarry("" parsed as an offline player, {_loc}) is false:
  121. stop
  122. set {_b} to block at {quarry.current.%{_loc}%}
  123. if {_b} is not bedrock:
  124. add {_b} to {_chest}'s inventory
  125. set block at {quarry.current.%{_loc}%} to air
  126.  
  127. set {_mine} to true
  128.  
  129. on rightclick on daylight detector:
  130. if checkQuarry(player, location of clicked block):
  131. cancel event
  132. quarryGUI(player, location of clicked block)
  133.  
  134. on inventory click:
  135. if inventory name of player's current inventory is "Quarry":
  136. cancel event
  137. if clicked slot is 21:
  138. if name of clicked item is "&aEnable":
  139. set {quarry.list.%{quarry.open.%player%}%.enabled} to true
  140. set slot 21 of player's current inventory to lime shulker box named "&aEnabled"
  141. set slot 23 of player's current inventory to red shulker box named "&cDisable"
  142. set slot 31 of player's current inventory to note block named "&7Reset" with lore "" and "&8This cannot be undone!"
  143. play "ENTITY_PLAYER_LEVELUP" to player at volume 10
  144. if {quarry.chest.%{quarry.open.%player%}%} is not set:
  145. if {quarry.chestDetect.%{quarry.open.%player%}%} is north:
  146. set {quarry.chest.%{quarry.open.%player%}%} to location 1 meters below and 1 meters north of {quarry.open.%player%}
  147.  
  148. else if {quarry.chestDetect.%{quarry.open.%player%}%} is east:
  149. set {quarry.chest.%{quarry.open.%player%}%} to location 1 meters below and 1 meters east of {quarry.open.%player%}
  150.  
  151. else if {quarry.chestDetect.%{quarry.open.%player%}%} is south:
  152. set {quarry.chest.%{quarry.open.%player%}%} to location 1 meters below and 1 meters south of {quarry.open.%player%}
  153.  
  154. else if {quarry.chestDetect.%{quarry.open.%player%}%} is west:
  155. set {quarry.chest.%{quarry.open.%player%}%} to location 1 meters below and 1 meters west of {quarry.open.%player%}
  156.  
  157. if {quarry.current.%{_quarry}%} is not set:
  158. if {quarry.chestDetect.%{_quarry}%} is north:
  159. set {quarry.current.%{_quarry}%} to location 4 meters north and 1 meters east and 2 meters below {_quarry}
  160. else if {quarry.chestDetect.%{_quarry}%} is east:
  161. set {quarry.current.%{_quarry}%} to location 4 meters east and 1 meters north and 2 meters below {_quarry}
  162. else if {quarry.chestDetect.%{_quarry}%} is south:
  163. set {quarry.current.%{_quarry}%} to location 4 meters south and 1 meters west and 2 meters below {_quarry}
  164. else if {quarry.chestDetect.%{_quarry}%} is west:
  165. set {quarry.current.%{_quarry}%} to location 4 meters west and 1 meters south and 2 meters below {_quarry}
  166.  
  167. set {quarry.startLoc.%{_quarry}%} to {quarry.current.%{_quarry}%}
  168. if {quarry.list::*} doesn't contain {_quarry}:
  169. add {_quarry} to {quarry.list::*}
  170.  
  171. mine({_quarry}, {quarry.startLoc.%{_quarry}%})
  172.  
  173. else:
  174. play "ENTITY_ITEM_BREAK" to player at volume 10
  175. else if clicked slot is 23:
  176. if name of clicked item is "&cDisable":
  177. delete {quarry.list.%{quarry.open.%player%}%.enabled}
  178. set slot 21 of player's current inventory to lime shulker box named "&aEnable"
  179. set slot 23 of player's current inventory to red shulker box named "&cDisabled"
  180. set slot 31 of player's current inventory to note block named "&7Reset" with lore "" and "&8This cannot be undone!"
  181. play "ENTITY_PLAYER_LEVELUP" to player at volume 10
  182. else:
  183. play "ENTITY_ITEM_BREAK" to player at volume 10
  184. else if clicked slot is 31:
  185. close player's inventory
  186. set {_quarry} to {quarry.open.%player%}
  187. set {quarry.row.%{_quarry}%} to 0
  188. set {quarry.colmn.%{_quarry}%} to 0
  189. set {quarry.depth.%{_quarry}%} to 0
  190. set {quarry.current.%{_quarry}%} to {quarry.startLoc.%{_quarry}%}
  191. delete {quarry.list.%{_quarry}%.enabled}
  192.  
  193. send "{@logo} You have reset the quarry! This cannot be undone."
  194. play "ENTITY_PLAYER_LEVELUP" to player at volume 10
  195.  
  196. on disable:
  197. loop {quarry.list::*}:
  198. if {quarry.list.%loop-value%.enabled} is true:
  199. set {quarry.list.%loop-value%.enabled} to false
  200. set {quarry.list.%loop-value%.forceEnabled} to true
  201. else:
  202. set {quarry.list.%loop-value%.forceEnabled} to false
  203.  
  204. on enable:
  205. loop {quarry.list::*}:
  206. if {quarry.list.%loop-value%.forceEnabled} is not false:
  207. set {quarry.list.%loop-value%.enabled} to true
  208. set {quarry.list.%loop-value%.forceEnabled} to false
  209. mine(loop-value, {quarry.startLoc.%loop-value%})
Add Comment
Please, Sign In to add comment