Advertisement
Zeldaboy111

Quarry Af! ]|[ Skript #327

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