Zeldaboy111

GUI's plannen ]|[ Skript #339

Aug 21st, 2020
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.06 KB | None | 0 0
  1. #multiblock structure
  2. #rename function
  3.  
  4. #requires: SkQuery, SkRayFall, Skellett, SkBee
  5.  
  6.  
  7. options:
  8. logo: &6&lBS&8:&7
  9.  
  10. function outlineGui(p: Player):
  11. loop 9 times:
  12. set slot loop-value - 1 of {_p}'s current inventory to gray stained glass pane named "&8"
  13. set slot 54-loop-value of {_p}'s current inventory to gray stained glass pane named "&8"
  14.  
  15. loop 5 times:
  16. set slot loop-value * 9 of {_p}'s current inventory to gray stained glass pane named "&8"
  17. set slot loop-value * 9-1 of {_p}'s current inventory to gray stained glass pane named "&8"
  18.  
  19. function openGuiOutlined(p: Player, rows: integer, name: String):
  20. open chest with {_rows} rows named {_name} to {_p}
  21. wait 2 ticks
  22. outlineGui({_p})
  23.  
  24. function gui(p: Player):
  25. openGuiOutlined({_p}, 6, "&8Anvil")
  26. #subcategorie armor -> alle armor die je kan maken laten zien
  27.  
  28. function guiFurnace1(p: Player, loc: Location):
  29. openGuiOutlined({_p}, 6, "&8Furnace")
  30.  
  31. #Slot voor fuel, ores en ingots
  32.  
  33. # {furnace1.%{_loc}%.contents.fuel} == fuel
  34. # {furnace1.%{_loc}%.contents.ore} == ores
  35. # {furnace1.%{_loc}%.contents.ingot} == ingots
  36.  
  37. # loop for the cooking -- use states
  38.  
  39.  
  40.  
  41.  
  42. # U T I L I T I E S
  43.  
  44. function getNextNumber(base: number, addToDefault: number, max: number) :: number:
  45. set {_value} to {_base} + {_addToDefault}
  46. if {_value} > {_max}:
  47. set {_value} to {_addToDefault} - ({_max} - {_base})
  48.  
  49. return {_value}
  50.  
  51. function detectStair(facing: number, loc: Location, startValue: String) :: boolean:
  52. set {_list::*} to "westward red brick stair", "red brick stair", "eastward red brick stair" and "southward red brick stair"
  53. set {_dir} to {_facing}/2 + 1
  54.  
  55. if {_dir} > 4:
  56. remove 4 from {_dir}
  57.  
  58. if "%block at location of {_loc}%" is "%{_startValue}%%{_list::%{_dir}%}%":
  59. return true
  60. return false
  61.  
  62.  
  63. # F U R N A C E D E T E C T S
  64.  
  65. function isFurnace1(below: Location) :: boolean:
  66. if block at {_below} is campfire:
  67. set {_xAdjust::*} to 1, 1, 1, 0, 0, -1, -1 and -1
  68. set {_zAdjust::*} to 1, 0, -1, 1, -1, 1, 0 and -1
  69. loop 8 times:
  70. set {_checkLoc} to location at x-coordinate of {_below}+{_xAdjust::%loop-value%}, y-coordinate of {_below}, z-coordinate of {_below}+{_zAdjust::%loop-value%} in world of {_below}
  71. if block at {_checkLoc} is not red brick block:
  72. return false
  73. else:
  74. return false
  75. return true
  76.  
  77.  
  78. function isFurnace2(loc: Location) :: boolean:
  79. if block at {_loc} is not blast furnace:
  80. return false
  81.  
  82. set {_layer1::*} to air, brick slab, red brick block, air, red brick block, air, red brick block and brick slab
  83. set {_layer2::*} to air, red brick stair, eastward red brick stair and southward red brick stair
  84. set {_x::*} to 1, 1, 0, -1, -1, -1, 0 and 1
  85. set {_z::*} to 0, 1, 1, 1, 0, -1, -1 and -1
  86.  
  87. set {_base} to -2
  88. if block at location at x-coordinate of {_loc} + {_x::1}, y-coordinate of {_loc}, z-coordinate of {_loc} + {_z::1} in world of {_loc} is {_layer1::1}:
  89. set {_base} to 0
  90.  
  91. else if block at location at x-coordinate of {_loc} + {_x::3}, y-coordinate of {_loc}, z-coordinate of {_loc} + {_z::3} in world of {_loc} is {_layer1::1}:
  92. set {_base} to 2
  93.  
  94. else if block at location at x-coordinate of {_loc} + {_x::5}, y-coordinate of {_loc}, z-coordinate of {_loc} + {_z::5} in world of {_loc} is {_layer1::1}:
  95. set {_base} to 4
  96.  
  97. else if block at location at x-coordinate of {_loc} + {_x::7}, y-coordinate of {_loc}, z-coordinate of {_loc} + {_z::7} in world of {_loc} is {_layer1::1}:
  98. set {_base} to 6
  99.  
  100. set {_size} to size of {_x::*}
  101. if {_base} is not -2:
  102. loop 7 times:
  103. set {_value} to getNextNumber({_base}, loop-value, {_size})
  104. if block at location at x-coordinate of {_loc} + {_x::%{_value}%}, y-coordinate of {_loc}, z-coordinate of {_loc} + {_z::%{_value}%} in world of {_loc} is not {_layer1::%loop-value%}:
  105. return false
  106.  
  107.  
  108. set {_facingAdjust::*} to 0, 4, 6 and 8
  109. if detectStair({_base}, location 1 meters above {_loc}, "top "):
  110. loop 4 times:
  111. set {_value} to getNextNumber({_base}, loop-value*2, {_size}) - 1
  112. set {_check} to location at x-coordinate of {_loc} + {_x::%{_value}%}, y-coordinate of {_loc} + 1, z-coordinate of {_loc} + {_z::%{_value}%} in world of {_loc}
  113. set {_facing} to {_base}
  114. if {_facing} - {_facingAdjust::%loop-value%} >= 2:
  115. remove {_facingAdjust::%loop-value%} from {_facing}
  116. else:
  117. add {_facingAdjust::%loop-value%} to {_facing}
  118.  
  119. if loop-value is 1:
  120. if block at {_check} is not {_layer2::%loop-value%}:
  121. return false
  122. else if detectStair({_facing} - 2, {_check}, "") is false:
  123. return false
  124.  
  125. if block at location 2 meters above {_loc} is not red brick block:
  126. return false
  127. else:
  128. return false
  129. else:
  130. return false
  131. return true
  132.  
  133. # C L I C K E V E N T S
  134.  
  135. on rightclick on smooth stone:
  136. if player is not sneaking:
  137. if {anvil.%location of clicked block%} is true:
  138. gui(player)
  139. cancel event
  140.  
  141. on rightclick on cauldron:
  142. if {furnace.%location of event-block%} is true:
  143. if isFurnace1(location 1 meters below clicked block):
  144. cancel event
  145. guiFurnace1({_p}, location of clicked block);
  146. #send "WIP"
  147. else:
  148. delete {furnace1.%location of clicked block%.contents.fuel}
  149. delete {furnace1.%location of clicked block%.contents.ore}
  150. delete {furnace1.%location of clicked block%.contents.ingot}
  151. delete {furnace.%location of event-block%}
  152.  
  153. on rightclick on blast furnace:
  154. if {furnace2.%location of event-block%} is true:
  155. if isFurnace2(location of clicked block):
  156. cancel event
  157. send "WIP"
  158. else:
  159. delete {furnace2.%location of event-block%}
  160.  
  161. on rightclick holding stone axe:
  162. if clicked block is smooth stone or iron block or diamond block:
  163. if {anvil.%location of event-block%} is not true:
  164. set {anvil.%location of event-block%} to true
  165. set {_tier} to "Tier I"
  166. if clicked block is smooth stone:
  167. set {anvil.%location of event-block%.tier} to 1
  168. else if clicked block is iron block:
  169. set {anvil.%location of event-block%.tier} to 2
  170. set {_tier} to "Tier II"
  171. else:
  172. set {anvil.%location of event-block%.tier} to 3
  173. set {_tier} to "Tier III"
  174.  
  175. set {_s} to 6
  176. loop all players in radius 6 around event-block:
  177. set {_v} to ({_s} - distance between loop-player and event-block)
  178. play sound "block.anvil.place" with volume {_v} and pitch 0 to loop-player
  179.  
  180. send "{@logo} Successfully created an anvil of %{_tier}%."
  181. summon armor stand at location 0.6 meters below event-block
  182. set name of last spawned armor stand to "&7Anvil"
  183. add "{Invisible:1b,NoGravity:1b,NoAI:1b,CustomNameVisible:1}" to NBT of last spawned armor stand
  184.  
  185. summon armor stand at location 0.9 meters below event-block
  186. set name of last spawned armor stand to "&7%{_tier}%"
  187. add "{Invisible:1b,NoGravity:1b,NoAI:1b,CustomNameVisible:1}" to NBT of last spawned armor stand
  188.  
  189. else if clicked block is cauldron:
  190. if {furnace.%location of event-block%} is not true:
  191. if isFurnace1(location 1 meters below clicked block):
  192. set {furnace.%location of event-block%} to true
  193. cancel event
  194. send "WIP"
  195.  
  196. else if clicked block is blast furnace:
  197. if {furnace.%location of event-block%} is not true:
  198. if isFurnace2(location of clicked block):
  199. set {furnace2.%location of event-block%} to true
  200. cancel event
  201. send "WIP"
  202.  
  203. on break of smooth stone or iron block or diamond block:
  204. if {anvil.%location of event-block%} is true:
  205. set {_s} to 6
  206. loop all players in radius 6 around event-block:
  207. set {_v} to ({_s} - distance between loop-player and event-block)
  208. play sound "block.anvil.place" with volume {_v} and pitch 0 to loop-player
  209. delete {anvil.%location of event-block%}
  210. delete {anvil.%location of event-block%.tier}
  211. loop entities in radius 1 around event-block:
  212. if type of loop-entity is armor stand:
  213. kill loop-entity
  214.  
  215.  
  216. on inventory click:
  217. if type of clicked inventory is chest inventory:
  218. if inventory name of player's current inventory is "&8Anvil":
  219. cancel event
  220.  
  221. #Cancel in crafting table or below
  222. #register new shaped recipe for air using iron ingot, air, iron ingot, iron ingot, chest, iron ingot, air, iron ingot, air
  223.  
Advertisement
Add Comment
Please, Sign In to add comment