Zeldaboy111

Quarry Detecties ]|[ Skript #320

Jun 14th, 2020
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.52 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. if {quarry.list.%{_loc}%.enabled} is true:
  44. set slot 21 of {_p}'s current inventory to lime shulker box named "&aEnabled"
  45. set slot 23 of {_p}'s current inventory to red shulker box named "&cDisable"
  46. else:
  47. set slot 21 of {_p}'s current inventory to lime shulker box named "&aEnable"
  48. set slot 23 of {_p}'s current inventory to red shulker box named "&cDisabled"
  49.  
  50. on rightclick on daylight detector:
  51. if checkQuarry(player, location of clicked block):
  52. cancel event
  53. quarryGUI(player, location of clicked block)
  54.  
  55. on inventory click:
  56. if inventory name of player's current inventory is "Quarry":
  57. cancel event
  58. if clicked slot is 21:
  59. if name of clicked item is "&aEnable":
  60. set {quarry.list.%{quarry.open.%player%}%.enabled} to true
  61. set slot 21 of player's current inventory to lime shulker box named "&aEnabled"
  62. set slot 23 of player's current inventory to red shulker box named "&cDisable"
  63. play "ENTITY_PLAYER_LEVELUP" to player at volume 10
  64. if {quarry.chest.%{quarry.open.%player%}%} is not set:
  65. if {quarry.chestDetect.%{quarry.open.%player%}%} is north:
  66. set {quarry.chest.%{quarry.open.%player%}%} to block at location 1 meters below and 1 meters north of {quarry.open.%player%}
  67.  
  68. else if {quarry.chestDetect.%{quarry.open.%player%}%} is east:
  69. set {quarry.chest.%{quarry.open.%player%}%} to block at location 1 meters below and 1 meters east of {quarry.open.%player%}
  70.  
  71. else if {quarry.chestDetect.%{quarry.open.%player%}%} is south:
  72. set {quarry.chest.%{quarry.open.%player%}%} to block at location 1 meters below and 1 meters south of {quarry.open.%player%}
  73.  
  74. else if {quarry.chestDetect.%{quarry.open.%player%}%} is west:
  75. set {quarry.chest.%{quarry.open.%player%}%} to block at location 1 meters below and 1 meters west of {quarry.open.%player%}
  76.  
  77. while {quarry.list.%{quarry.open.%player%}%.enabled}:
  78. broadcast "MINE"
  79. wait 7 seconds
  80.  
  81. else:
  82. play "ENTITY_ITEM_BREAK" to player at volume 10
  83. else if clicked slot is 23:
  84. if name of clicked item is "&cDisable":
  85. delete {quarry.list.%{quarry.open.%player%}%.enabled}
  86. set slot 21 of player's current inventory to lime shulker box named "&aEnable"
  87. set slot 23 of player's current inventory to red shulker box named "&cDisabled"
  88. #CHECK SET AND SET INTO VARIABLE
  89. play "ENTITY_PLAYER_LEVELUP" to player at volume 10
  90. else:
  91. play "ENTITY_ITEM_BREAK" to player at volume 10#GUI when clicking on it
  92. function checkQuarry(p: Player, loc: Location) :: boolean:
  93. set {_below} to block 1 meters below {_loc}
  94. if block at {_below} is not dropper:
  95. return false
  96. set {_detected} to false
  97. if block at location 1 meters north of {_below} is hopper:
  98. if block at location 1 meters south of {_below} is chest:
  99. if block at location 2 meters south of {_below} is chest:
  100. set {_detected} to true
  101. set {quarry.chestDetect.%{_loc}%} to north
  102. else if block at location 1 meters east of {_below} is hopper:
  103. if block at location 1 meters west of {_below} is chest:
  104. if block at location 2 meters west of {_below} is chest:
  105. set {_detected} to true
  106. set {quarry.chestDetect.%{_loc}%} to east
  107. else if block at location 1 meters south of {_below} is hopper:
  108. if block at location 1 meters north of {_below} is chest:
  109. if block at location 2 meters north of {_below} is chest:
  110. set {_detected} to true
  111. set {quarry.chestDetect.%{_loc}%} to south
  112. else if block at location 1 meters west of {_below} is hopper:
  113. if block at location 1 meters east of {_below} is chest:
  114. if block at location 2 meters east of {_below} is chest:
  115. set {_detected} to true
  116. set {quarry.chestDetect.%{_loc}%} to west
  117.  
  118. return {_detected}
  119.  
  120. function quarryGUI(p: Player, loc: Location):
  121. set {quarry.open.%{_p}%} to {_loc}
  122. open chest with 5 rows named "Quarry" to {_p}
  123. wait 2 ticks
  124. set {_count} to 45
  125. loop 9 times:
  126. set slot loop-value - 1 of {_p}'s current inventory to gray stained glass pane named "&8"
  127. set slot {_count} - loop-value of {_p}'s current inventory to gray stained glass pane named "&8"
  128.  
  129. loop 4 times:
  130. set slot 9*loop-value of {_p}'s current inventory to gray stained glass pane named "&8"
  131. set slot 9*loop-value - 1 of {_p}'s current inventory to gray stained glass pane named "&8"
  132.  
  133. if {quarry.list.%{_loc}%.enabled} is true:
  134. set slot 21 of {_p}'s current inventory to lime shulker box named "&aEnabled"
  135. set slot 23 of {_p}'s current inventory to red shulker box named "&cDisable"
  136. else:
  137. set slot 21 of {_p}'s current inventory to lime shulker box named "&aEnable"
  138. set slot 23 of {_p}'s current inventory to red shulker box named "&cDisabled"
  139.  
  140. on rightclick on daylight detector:
  141. if checkQuarry(player, location of clicked block):
  142. cancel event
  143. quarryGUI(player, location of clicked block)
  144.  
  145. on inventory click:
  146. if inventory name of player's current inventory is "Quarry":
  147. cancel event
  148. if clicked slot is 21:
  149. if name of clicked item is "&aEnable":
  150. set {quarry.list.%{quarry.open.%player%}%.enabled} to true
  151. set slot 21 of player's current inventory to lime shulker box named "&aEnabled"
  152. set slot 23 of player's current inventory to red shulker box named "&cDisable"
  153. play "ENTITY_PLAYER_LEVELUP" to player at volume 10
  154. if {quarry.chest.%{quarry.open.%player%}%} is not set:
  155. if {quarry.chestDetect.%{quarry.open.%player%}%} is north:
  156. set {quarry.chest.%{quarry.open.%player%}%} to block at location 1 meters below and 1 meters north of {quarry.open.%player%}
  157.  
  158. else if {quarry.chestDetect.%{quarry.open.%player%}%} is east:
  159. set {quarry.chest.%{quarry.open.%player%}%} to block at location 1 meters below and 1 meters east of {quarry.open.%player%}
  160.  
  161. else if {quarry.chestDetect.%{quarry.open.%player%}%} is south:
  162. set {quarry.chest.%{quarry.open.%player%}%} to block at location 1 meters below and 1 meters south of {quarry.open.%player%}
  163.  
  164. else if {quarry.chestDetect.%{quarry.open.%player%}%} is west:
  165. set {quarry.chest.%{quarry.open.%player%}%} to block at location 1 meters below and 1 meters west of {quarry.open.%player%}
  166.  
  167. while {quarry.list.%{quarry.open.%player%}%.enabled}:
  168. broadcast "MINE"
  169. wait 7 seconds
  170.  
  171. else:
  172. play "ENTITY_ITEM_BREAK" to player at volume 10
  173. else if clicked slot is 23:
  174. if name of clicked item is "&cDisable":
  175. delete {quarry.list.%{quarry.open.%player%}%.enabled}
  176. set slot 21 of player's current inventory to lime shulker box named "&aEnable"
  177. set slot 23 of player's current inventory to red shulker box named "&cDisabled"
  178. #CHECK SET AND SET INTO VARIABLE
  179. play "ENTITY_PLAYER_LEVELUP" to player at volume 10
  180. else:
  181. play "ENTITY_ITEM_BREAK" to player at volume 10
Add Comment
Please, Sign In to add comment