Advertisement
Zeldaboy111

Quarry Mine Functie {1} ]|[ Skript #322

Jun 21st, 2020
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.75 KB | None | 0 0
  1. #GUI when clicking on it
  2. function checkQuarry(p: Player, loc: Location) :: boolean:
  3. set {_below} to block 1 meters below {_loc}
  4. if block at {_below} is not dropper:
  5. return false
  6. set {_detected} to false
  7. if block at location 1 meters north of {_below} is hopper:
  8. if block at location 1 meters south of {_below} is chest:
  9. if block at location 2 meters south of {_below} is chest:
  10. set {_detected} to true
  11. set {quarry.chestDetect.%{_loc}%} to north
  12. else if block at location 1 meters east of {_below} is hopper:
  13. if block at location 1 meters west of {_below} is chest:
  14. if block at location 2 meters west of {_below} is chest:
  15. set {_detected} to true
  16. set {quarry.chestDetect.%{_loc}%} to east
  17. else if block at location 1 meters south of {_below} is hopper:
  18. if block at location 1 meters north of {_below} is chest:
  19. if block at location 2 meters north of {_below} is chest:
  20. set {_detected} to true
  21. set {quarry.chestDetect.%{_loc}%} to south
  22. else if block at location 1 meters west of {_below} is hopper:
  23. if block at location 1 meters east of {_below} is chest:
  24. if block at location 2 meters east of {_below} is chest:
  25. set {_detected} to true
  26. set {quarry.chestDetect.%{_loc}%} to west
  27.  
  28. return {_detected}
  29.  
  30. function quarryGUI(p: Player, loc: Location):
  31. set {quarry.open.%{_p}%} to {_loc}
  32. open chest with 5 rows named "Quarry" to {_p}
  33. wait 2 ticks
  34. set {_count} to 45
  35. loop 9 times:
  36. set slot loop-value - 1 of {_p}'s current inventory to gray stained glass pane named "&8"
  37. set slot {_count} - loop-value of {_p}'s current inventory to gray stained glass pane named "&8"
  38.  
  39. loop 4 times:
  40. set slot 9*loop-value of {_p}'s current inventory to gray stained glass pane named "&8"
  41. set slot 9*loop-value - 1 of {_p}'s current inventory to gray stained glass pane named "&8"
  42.  
  43. #RESET SLOT
  44.  
  45. if {quarry.list.%{_loc}%.enabled} is true:
  46. set slot 21 of {_p}'s current inventory to lime shulker box named "&aEnabled"
  47. set slot 23 of {_p}'s current inventory to red shulker box named "&cDisable"
  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.  
  52. function mine(loc: Location):
  53. while {quarry.list.%{_loc}%.enabled}:
  54. #3 east, 1 north
  55. set {_mine} to false
  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.  
  63. if {quarry.row.%{_loc}%} > 5:
  64. set {quarry.row.%{_loc}%} to 0
  65. if {quarry.colmn.%{_loc}%} <= 5:
  66. add 1 to {quarry.colmn.%{_loc}%}
  67. else:
  68. set {quarry.colmn.%{_loc}%} to 0
  69. if y-coordinate of {quarry.current.%{_loc}%} > 0:
  70. add 1 to {quarry.depth.%{_loc}%}
  71. set {quarry.current.%{_loc}%} to location {quarry.depth.%{_loc}%} meters below {_loc}
  72. else:
  73. set {quarry.list.%{_loc}%.enabled} to false
  74. delete {quarry.current.%{_loc}%}
  75. else:
  76. add 1 to {quarry.row.%{_loc}%}
  77.  
  78. checkQuarry("" parsed as an offline player, {_loc})
  79. set {_b} to block at {quarry.current.%{_loc}%}
  80. add {_b} to {quarry.chest.%{_loc}%}
  81. set block at {quarry.current.%{_loc}%} to dirt
  82. broadcast "%{_b}% = block"
  83.  
  84. set {_mine} to true
  85. if {_mine}:
  86. wait 7 seconds
  87.  
  88. on rightclick on daylight detector:
  89. if checkQuarry(player, location of clicked block):
  90. cancel event
  91. quarryGUI(player, location of clicked block)
  92.  
  93. on inventory click:
  94. if inventory name of player's current inventory is "Quarry":
  95. cancel event
  96. if clicked slot is 21:
  97. if name of clicked item is "&aEnable":
  98. set {quarry.list.%{quarry.open.%player%}%.enabled} to true
  99. set slot 21 of player's current inventory to lime shulker box named "&aEnabled"
  100. set slot 23 of player's current inventory to red shulker box named "&cDisable"
  101. play "ENTITY_PLAYER_LEVELUP" to player at volume 10
  102. if {quarry.chest.%{quarry.open.%player%}%} is not set:
  103. if {quarry.chestDetect.%{quarry.open.%player%}%} is north:
  104. set {quarry.chest.%{quarry.open.%player%}%} to block at location 1 meters below and 1 meters north of {quarry.open.%player%}
  105.  
  106. else if {quarry.chestDetect.%{quarry.open.%player%}%} is east:
  107. set {quarry.chest.%{quarry.open.%player%}%} to block at location 1 meters below and 1 meters east of {quarry.open.%player%}
  108.  
  109. else if {quarry.chestDetect.%{quarry.open.%player%}%} is south:
  110. set {quarry.chest.%{quarry.open.%player%}%} to block at location 1 meters below and 1 meters south of {quarry.open.%player%}
  111.  
  112. else if {quarry.chestDetect.%{quarry.open.%player%}%} is west:
  113. set {quarry.chest.%{quarry.open.%player%}%} to block at location 1 meters below and 1 meters west of {quarry.open.%player%}
  114.  
  115. set {_quarry} to {quarry.open.%player%}
  116. delete {quarry.current.%{_quarry}%}
  117. if {quarry.current.%{_quarry}%} is not set:
  118. if {quarry.chestDetect.%{quarry.open.%player%}%} is north:
  119. set {quarry.current.%{_quarry}%} to location 3 meters west and 1 meters north and 2 meters below {_quarry}
  120. else if {quarry.chestDetect.%{quarry.open.%player%}%} is east:
  121. set {quarry.current.%{_quarry}%} to location 3 meters east and 1 meters north and 2 meters below {_quarry}
  122. else if {quarry.chestDetect.%{quarry.open.%player%}%} is south:
  123. set {quarry.current.%{_quarry}%} to location 3 meters east and 1 meters south and 2 meters below {_quarry}
  124. else if {quarry.chestDetect.%{quarry.open.%player%}%} is west:
  125. set {quarry.current.%{_quarry}%} to location 3 meters south and 1 meters west and 2 meters below {_quarry}
  126.  
  127. if {quarry.list::*} doesn't contain {_quarry}:
  128. add {_quarry} to {quarry.list::*}
  129.  
  130. mine({_quarry})
  131.  
  132. else:
  133. play "ENTITY_ITEM_BREAK" to player at volume 10
  134. else if clicked slot is 23:
  135. if name of clicked item is "&cDisable":
  136. delete {quarry.list.%{quarry.open.%player%}%.enabled}
  137. set slot 21 of player's current inventory to lime shulker box named "&aEnable"
  138. set slot 23 of player's current inventory to red shulker box named "&cDisabled"
  139. #CHECK SET AND SET INTO VARIABLE
  140. play "ENTITY_PLAYER_LEVELUP" to player at volume 10
  141. else:
  142. play "ENTITY_ITEM_BREAK" to player at volume 10
  143.  
  144. on disable:
  145. loop {quarry.list::*}:
  146. if {quarry.list.%loop-value%.enabled} is true:
  147. set {quarry.list.%loop-value%.enabled} to false
  148. set {quarry.list.%loop-value%.forceEnabled} to true
  149. else:
  150. set {quarry.list.%loop-value%.forceEnabled} to false
  151.  
  152. on enable:
  153. loop {quarry.list::*}:
  154. if {quarry.list.%loop-value%.forceEnabled} is not false:
  155. set {quarry.list.%loop-value%.enabled} to true
  156. set {quarry.list.%loop-value%.forceEnabled} to false
  157. mine(loop-value)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement