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 north
- 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 east
- 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 south
- 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 west
- 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"
- 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"
- 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 block at 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 block at 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 block at 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 block at location 1 meters below and 1 meters west of {quarry.open.%player%}
- while {quarry.list.%{quarry.open.%player%}%.enabled}:
- broadcast "MINE"
- wait 7 seconds
- 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#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 north
- 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 east
- 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 south
- 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 west
- 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"
- 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"
- 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 block at 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 block at 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 block at 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 block at location 1 meters below and 1 meters west of {quarry.open.%player%}
- while {quarry.list.%{quarry.open.%player%}%.enabled}:
- broadcast "MINE"
- wait 7 seconds
- 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
Add Comment
Please, Sign In to add comment