Zeldaboy111

Quarry ]|[ Skript #321

Jun 19th, 2020
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.19 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. set {_quarry} to {quarry.open.%player%}
  78. delete {quarry.current.%{_quarry}%}
  79. if {quarry.current.%{_quarry}%} is not set:
  80. if {quarry.chestDetect.%{quarry.open.%player%}%} is north:
  81. set {quarry.current.%{_quarry}%} to location 3 meters west and 1 meters north and 2 meters below {_quarry}
  82. else if {quarry.chestDetect.%{quarry.open.%player%}%} is east:
  83. set {quarry.current.%{_quarry}%} to location 3 meters north and 1 meters east and 2 meters below {_quarry}
  84. else if {quarry.chestDetect.%{quarry.open.%player%}%} is south:
  85. set {quarry.current.%{_quarry}%} to location 3 meters east and 1 meters south and 2 meters below {_quarry}
  86. else if {quarry.chestDetect.%{quarry.open.%player%}%} is west:
  87. set {quarry.current.%{_quarry}%} to location 3 meters south and 1 meters west and 2 meters below {_quarry}
  88.  
  89. while {quarry.list.%{_quarry}%.enabled}:
  90. #3 east, 1 north
  91. set {_mine} to false
  92. if {quarry.row.%{_quarry}%} is not set:
  93. set {quarry.row.%{_quarry}%} to 0
  94. if {quarry.colmn.%{_quarry}%} is not set:
  95. set {quarry.colmn.%{_quarry}%} to 0
  96. if {quarry.depth.%{_quarry}%} is not set:
  97. set {quarry.depth.%{_quarry}%} to 0
  98.  
  99. if {quarry.row.%{_quarry}%} > 5:
  100. set {quarry.row.%{_quarry}%} to 0
  101. if {quarry.colmn.%{_quarry}%} <= 5:
  102. add 1 to {quarry.colmn.%{_quarry}%}
  103. else:
  104. set {quarry.colmn.%{_quarry}%} to 0
  105. if y-coordinate of {quarry.current.%{_quarry}%} > 0:
  106. add 1 to {quarry.depth.%{_quarry}%}
  107. set {quarry.current.%{_quarry}%} to location {quarry.depth.%{_quarry}%} meters below {_quarry}
  108. else:
  109. set {quarry.list.%{_quarry}%.enabled} to false
  110. delete {quarry.current.%{_quarry}%}
  111. else:
  112. add 1 to {quarry.row.%{_quarry}%}
  113.  
  114. checkQuarry("" parsed as an offline player, {_quarry})
  115. set {_b} to block at {quarry.current.%{_quarry}%}
  116. add {_b} to {quarry.chest.%{_quarry}%}
  117.  
  118.  
  119. set {_mine} to true
  120. if {_mine}:
  121. wait 7 seconds
  122.  
  123. else:
  124. play "ENTITY_ITEM_BREAK" to player at volume 10
  125. else if clicked slot is 23:
  126. if name of clicked item is "&cDisable":
  127. delete {quarry.list.%{quarry.open.%player%}%.enabled}
  128. set slot 21 of player's current inventory to lime shulker box named "&aEnable"
  129. set slot 23 of player's current inventory to red shulker box named "&cDisabled"
  130. #CHECK SET AND SET INTO VARIABLE
  131. play "ENTITY_PLAYER_LEVELUP" to player at volume 10
  132. else:
  133. play "ENTITY_ITEM_BREAK" to player at volume 10
Add Comment
Please, Sign In to add comment