Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #GUI when clicking on it
- function checkQuarry(p: Player, loc: Location) :: boolean:
- set {_below} to block 1 meters below {_loc}
- if block at {_below} is not dropper:
- return false
- set {_detected} to false
- if block at location 1 meters north of {_below} is hopper:
- if block at location 1 meters south of {_below} is chest:
- if block at location 2 meters south of {_below} is chest:
- set {_detected} to true
- set {quarry.chestDetect.%{_loc}%} to south
- else if block at location 1 meters east of {_below} is hopper:
- if block at location 1 meters west of {_below} is chest:
- if block at location 2 meters west of {_below} is chest:
- set {_detected} to true
- set {quarry.chestDetect.%{_loc}%} to west
- else if block at location 1 meters south of {_below} is hopper:
- if block at location 1 meters north of {_below} is chest:
- if block at location 2 meters north of {_below} is chest:
- set {_detected} to true
- set {quarry.chestDetect.%{_loc}%} to north
- else if block at location 1 meters west of {_below} is hopper:
- if block at location 1 meters east of {_below} is chest:
- if block at location 2 meters east of {_below} is chest:
- set {_detected} to true
- set {quarry.chestDetect.%{_loc}%} to east
- return {_detected}
- function quarryGUI(p: Player, loc: Location):
- set {quarry.open.%{_p}%} to {_loc}
- open chest with 5 rows named "Quarry" to {_p}
- wait 2 ticks
- set {_count} to 45
- loop 9 times:
- set slot loop-value - 1 of {_p}'s current inventory to gray stained glass pane named "&8"
- set slot {_count} - loop-value of {_p}'s current inventory to gray stained glass pane named "&8"
- loop 4 times:
- set slot 9*loop-value of {_p}'s current inventory to gray stained glass pane named "&8"
- set slot 9*loop-value - 1 of {_p}'s current inventory to gray stained glass pane named "&8"
- #RESET SLOT
- if {quarry.list.%{_loc}%.enabled} is true:
- set slot 21 of {_p}'s current inventory to lime shulker box named "&aEnabled"
- set slot 23 of {_p}'s current inventory to red shulker box named "&cDisable"
- else:
- set slot 21 of {_p}'s current inventory to lime shulker box named "&aEnable"
- set slot 23 of {_p}'s current inventory to red shulker box named "&cDisabled"
- function mine(loc: Location, startLoc: Location):
- set {_mine} to true
- set {_chest} to block at {quarry.chest.%{_loc}%}
- set {quarry.row.%{_loc}%} to 0
- set {quarry.colmn.%{_loc}%} to 0
- set {quarry.depth.%{_loc}%} to 0
- while {quarry.list.%{_loc}%.enabled}:
- if {_mine}:
- wait 10 ticks
- #wait 7 seconds
- else:
- wait 30 ticks
- set {_mine} to false
- if {quarry.row.%{_loc}%} is not set:
- set {quarry.row.%{_loc}%} to 0
- if {quarry.colmn.%{_loc}%} is not set:
- set {quarry.colmn.%{_loc}%} to 0
- if {quarry.depth.%{_loc}%} is not set:
- set {quarry.depth.%{_loc}%} to 0
- if {quarry.row.%{_loc}%} > 5:
- set {quarry.row.%{_loc}%} to 0
- if {quarry.colmn.%{_loc}%} <= 5:
- add 1 to {quarry.colmn.%{_loc}%}
- if {quarry.chestDetect.%{_loc}%} is north:
- set {quarry.current.%{_loc}%} to location 1 meters east and 5 meters north of {quarry.current.%{_loc}%}
- else if {quarry.chestDetect.%{_loc}%} is east:
- set {quarry.current.%{_loc}%} to location 1 meters north and 5 meters east of {quarry.current.%{_loc}%}
- else if {quarry.chestDetect.%{_loc}%} is south:
- set {quarry.current.%{_loc}%} to location 1 meters west and 5 meters south of {quarry.current.%{_loc}%}
- else if {quarry.chestDetect.%{_loc}%} is west:
- set {quarry.current.%{_loc}%} to location 1 meters south and 5 meters west of {quarry.current.%{_loc}%}
- else:
- set {quarry.colmn.%{_loc}%} to 0
- if y-coordinate of {quarry.current.%{_loc}%} > 0:
- add 1 to {quarry.depth.%{_loc}%}
- set {quarry.current.%{_loc}%} to location {quarry.depth.%{_loc}%} meters below {_startLoc}
- else:
- set {quarry.list.%{_loc}%.enabled} to false
- delete {quarry.current.%{_loc}%}
- else:
- add 1 to {quarry.row.%{_loc}%}
- if {quarry.chestDetect.%{_loc}%} is north:
- set {quarry.current.%{_loc}%} to location 1 meters south of {quarry.current.%{_loc}%}
- else if {quarry.chestDetect.%{_loc}%} is east:
- set {quarry.current.%{_loc}%} to location 1 meters west of {quarry.current.%{_loc}%}
- else if {quarry.chestDetect.%{_loc}%} is south:
- set {quarry.current.%{_loc}%} to location 1 meters north of {quarry.current.%{_loc}%}
- else if {quarry.chestDetect.%{_loc}%} is west:
- set {quarry.current.%{_loc}%} to location 1 meters east of {quarry.current.%{_loc}%}
- if checkQuarry("" parsed as an offline player, {_loc}) is false:
- stop
- set {_b} to block at {quarry.current.%{_loc}%}
- add {_b} to {_chest}'s inventory
- set block at {quarry.current.%{_loc}%} to air
- set {_mine} to true
- on rightclick on daylight detector:
- if checkQuarry(player, location of clicked block):
- cancel event
- quarryGUI(player, location of clicked block)
- on inventory click:
- if inventory name of player's current inventory is "Quarry":
- cancel event
- if clicked slot is 21:
- if name of clicked item is "&aEnable":
- set {quarry.list.%{quarry.open.%player%}%.enabled} to true
- set slot 21 of player's current inventory to lime shulker box named "&aEnabled"
- set slot 23 of player's current inventory to red shulker box named "&cDisable"
- play "ENTITY_PLAYER_LEVELUP" to player at volume 10
- if {quarry.chest.%{quarry.open.%player%}%} is not set:
- if {quarry.chestDetect.%{quarry.open.%player%}%} is north:
- set {quarry.chest.%{quarry.open.%player%}%} to location 1 meters below and 1 meters north of {quarry.open.%player%}
- else if {quarry.chestDetect.%{quarry.open.%player%}%} is east:
- set {quarry.chest.%{quarry.open.%player%}%} to location 1 meters below and 1 meters east of {quarry.open.%player%}
- else if {quarry.chestDetect.%{quarry.open.%player%}%} is south:
- set {quarry.chest.%{quarry.open.%player%}%} to location 1 meters below and 1 meters south of {quarry.open.%player%}
- else if {quarry.chestDetect.%{quarry.open.%player%}%} is west:
- set {quarry.chest.%{quarry.open.%player%}%} to location 1 meters below and 1 meters west of {quarry.open.%player%}
- set {_quarry} to {quarry.open.%player%}
- delete {quarry.current.%{_quarry}%}
- if {quarry.current.%{_quarry}%} is not set:
- if {quarry.chestDetect.%{_quarry}%} is north:
- set {quarry.current.%{_quarry}%} to location 4 meters north and 1 meters east and 2 meters below {_quarry}
- else if {quarry.chestDetect.%{_quarry}%} is east:
- set {quarry.current.%{_quarry}%} to location 4 meters east and 1 meters north and 2 meters below {_quarry}
- else if {quarry.chestDetect.%{_quarry}%} is south:
- set {quarry.current.%{_quarry}%} to location 4 meters south and 1 meters west and 2 meters below {_quarry}
- else if {quarry.chestDetect.%{_quarry}%} is west:
- set {quarry.current.%{_quarry}%} to location 4 meters west and 1 meters south and 2 meters below {_quarry}
- set {quarry.startLoc.%{_quarry}%} to {quarry.current.%{_quarry}%}
- if {quarry.list::*} doesn't contain {_quarry}:
- add {_quarry} to {quarry.list::*}
- mine({_quarry}, {quarry.startLoc.%{_quarry}%})
- else:
- play "ENTITY_ITEM_BREAK" to player at volume 10
- else if clicked slot is 23:
- if name of clicked item is "&cDisable":
- delete {quarry.list.%{quarry.open.%player%}%.enabled}
- set slot 21 of player's current inventory to lime shulker box named "&aEnable"
- set slot 23 of player's current inventory to red shulker box named "&cDisabled"
- #CHECK SET AND SET INTO VARIABLE
- play "ENTITY_PLAYER_LEVELUP" to player at volume 10
- else:
- play "ENTITY_ITEM_BREAK" to player at volume 10
- on disable:
- loop {quarry.list::*}:
- if {quarry.list.%loop-value%.enabled} is true:
- set {quarry.list.%loop-value%.enabled} to false
- set {quarry.list.%loop-value%.forceEnabled} to true
- else:
- set {quarry.list.%loop-value%.forceEnabled} to false
- on enable:
- loop {quarry.list::*}:
- if {quarry.list.%loop-value%.forceEnabled} is not false:
- set {quarry.list.%loop-value%.enabled} to true
- set {quarry.list.%loop-value%.forceEnabled} to false
- mine(loop-value, {quarry.startLoc.%loop-value%})
Add Comment
Please, Sign In to add comment