Advertisement
Zeldaboy111

Mine Functie {2} ]|[ Skript #323

Jun 26th, 2020
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.26 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 south
  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 west
  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 north
  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 east
  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. set {_mine} to true
  54. while {quarry.list.%{_loc}%.enabled}:
  55. if {_mine}:
  56. wait 10 ticks
  57. #wait 7 seconds
  58.  
  59. set {_mine} to false
  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.  
  67. if {quarry.row.%{_loc}%} > 5:
  68. set {quarry.row.%{_loc}%} to 0
  69. if {quarry.colmn.%{_loc}%} <= 5:
  70. add 1 to {quarry.colmn.%{_loc}%}
  71. else:
  72. set {quarry.colmn.%{_loc}%} to 0
  73. if y-coordinate of {quarry.current.%{_loc}%} > 0:
  74. add 1 to {quarry.depth.%{_loc}%}
  75. set {quarry.current.%{_loc}%} to location {quarry.depth.%{_loc}%} meters below {_loc}
  76. else:
  77. set {quarry.list.%{_loc}%.enabled} to false
  78. delete {quarry.current.%{_loc}%}
  79. else:
  80. add 1 to {quarry.row.%{_loc}%}
  81. if {quarry.chestDetect.%{_loc}%} is north:
  82. set {quarry.current.%{_loc}%} to location 1 meters south of {quarry.current.%{_loc}%}
  83. else if {quarry.chestDetect.%{_loc}%} is east:
  84. set {quarry.current.%{_loc}%} to location 1 meters west of {quarry.current.%{_loc}%}
  85. else if {quarry.chestDetect.%{_loc}%} is south:
  86. set {quarry.current.%{_loc}%} to location 1 meters north of {quarry.current.%{_loc}%}
  87. else if {quarry.chestDetect.%{_loc}%} is west:
  88. set {quarry.current.%{_loc}%} to location 1 meters east of {quarry.current.%{_loc}%}
  89.  
  90. checkQuarry("" parsed as an offline player, {_loc})
  91. set {_b} to block at {quarry.current.%{_loc}%}
  92. add {_b} to {quarry.chest.%{_loc}%}
  93. set block at {quarry.current.%{_loc}%} to dirt
  94.  
  95. set {_mine} to true
  96.  
  97. on rightclick on daylight detector:
  98. if checkQuarry(player, location of clicked block):
  99. cancel event
  100. quarryGUI(player, location of clicked block)
  101.  
  102. on inventory click:
  103. if inventory name of player's current inventory is "Quarry":
  104. cancel event
  105. if clicked slot is 21:
  106. if name of clicked item is "&aEnable":
  107. set {quarry.list.%{quarry.open.%player%}%.enabled} to true
  108. set slot 21 of player's current inventory to lime shulker box named "&aEnabled"
  109. set slot 23 of player's current inventory to red shulker box named "&cDisable"
  110. play "ENTITY_PLAYER_LEVELUP" to player at volume 10
  111. #delete {quarry.chest.%{quarry.open.%player%}%}
  112. if {quarry.chest.%{quarry.open.%player%}%} is not set:
  113. if {quarry.chestDetect.%{quarry.open.%player%}%} is north:
  114. set {quarry.chest.%{quarry.open.%player%}%} to location 1 meters below and 1 meters north of {quarry.open.%player%}
  115.  
  116. else if {quarry.chestDetect.%{quarry.open.%player%}%} is east:
  117. set {quarry.chest.%{quarry.open.%player%}%} to location 1 meters below and 1 meters east of {quarry.open.%player%}
  118.  
  119. else if {quarry.chestDetect.%{quarry.open.%player%}%} is south:
  120. set {quarry.chest.%{quarry.open.%player%}%} to location 1 meters below and 1 meters south of {quarry.open.%player%}
  121.  
  122. else if {quarry.chestDetect.%{quarry.open.%player%}%} is west:
  123. set {quarry.chest.%{quarry.open.%player%}%} to location 1 meters below and 1 meters west of {quarry.open.%player%}
  124.  
  125. set {_quarry} to {quarry.open.%player%}
  126. delete {quarry.current.%{_quarry}%}
  127. if {quarry.current.%{_quarry}%} is not set:
  128. if {quarry.chestDetect.%{_quarry}%} is north:
  129. set {quarry.current.%{_quarry}%} to location 3 meters north and 1 meters east and 2 meters below {_quarry}
  130. else if {quarry.chestDetect.%{_quarry}%} is east:
  131. set {quarry.current.%{_quarry}%} to location 3 meters east and 1 meters north and 2 meters below {_quarry}
  132. else if {quarry.chestDetect.%{_quarry}%} is south:
  133. set {quarry.current.%{_quarry}%} to location 3 meters south and 1 meters west and 2 meters below {_quarry}
  134. else if {quarry.chestDetect.%{_quarry}%} is west:
  135. set {quarry.current.%{_quarry}%} to location 3 meters west and 1 meters south and 2 meters below {_quarry}
  136.  
  137. if {quarry.list::*} doesn't contain {_quarry}:
  138. add {_quarry} to {quarry.list::*}
  139.  
  140. mine({_quarry})
  141.  
  142. else:
  143. play "ENTITY_ITEM_BREAK" to player at volume 10
  144. else if clicked slot is 23:
  145. if name of clicked item is "&cDisable":
  146. delete {quarry.list.%{quarry.open.%player%}%.enabled}
  147. set slot 21 of player's current inventory to lime shulker box named "&aEnable"
  148. set slot 23 of player's current inventory to red shulker box named "&cDisabled"
  149. #CHECK SET AND SET INTO VARIABLE
  150. play "ENTITY_PLAYER_LEVELUP" to player at volume 10
  151. else:
  152. play "ENTITY_ITEM_BREAK" to player at volume 10
  153.  
  154. on disable:
  155. loop {quarry.list::*}:
  156. if {quarry.list.%loop-value%.enabled} is true:
  157. set {quarry.list.%loop-value%.enabled} to false
  158. set {quarry.list.%loop-value%.forceEnabled} to true
  159. else:
  160. set {quarry.list.%loop-value%.forceEnabled} to false
  161.  
  162. on enable:
  163. loop {quarry.list::*}:
  164. if {quarry.list.%loop-value%.forceEnabled} is not false:
  165. set {quarry.list.%loop-value%.enabled} to true
  166. set {quarry.list.%loop-value%.forceEnabled} to false
  167. mine(loop-value)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement