Advertisement
Zeldaboy111

Multi block-structure ]|[ Skript #337

Aug 14th, 2020
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.13 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 gui(p: Player):
  11. open chest with 6 rows named "&8Anvil" to {_p}
  12. wait 2 ticks
  13. loop 9 times:
  14. set slot loop-value - 1 of {_p}'s current inventory to gray stained glass pane named "&8"
  15. set slot 54-loop-value of {_p}'s current inventory to gray stained glass pane named "&8"
  16.  
  17. loop 5 times:
  18. set slot loop-value * 9 of {_p}'s current inventory to gray stained glass pane named "&8"
  19. set slot loop-value * 9-1 of {_p}'s current inventory to gray stained glass pane named "&8"
  20.  
  21. function detectStair(facing: number, loc: Location) :: boolean:
  22. if {_facing} is 0:
  23. if block at location 1 meters above {_loc} is top westward red brick stair:
  24. return true
  25.  
  26. else if {_facing} is 2:
  27. if "%block at location 1 meters above {_loc}%" is "top red brick stair":
  28. return true
  29.  
  30. else if {_facing} is 4:
  31. if block at location 1 meters above {_loc} is top eastward red brick stair:
  32. return true
  33.  
  34. else if {_facing} is 6:
  35. if block at location 1 meters above {_loc} is top northward red brick stair:
  36. return true
  37.  
  38. return false
  39.  
  40. function getNextNumber(baseDefault: number, base: number, addToDefault: number, max: number) :: number:
  41. if {_addToDefault} + {_base} > {_max}:
  42. set {_base} to {_max}
  43. set {_value} to {_base} + {_addToDefault}
  44. if {_base} is not {_baseDefault}:
  45. set {_value} to {_base} - {_addToDefault}
  46. return {_value}
  47.  
  48. function isFurnace1(below: Location) :: boolean:
  49. if block at {_below} is campfire:
  50. set {_xAdjust::*} to 1, 1, 1, 0, 0, -1, -1 and -1
  51. set {_zAdjust::*} to 1, 0, -1, 1, -1, 1, 0 and -1
  52. loop 8 times:
  53. 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}
  54. if block at {_checkLoc} is not red brick block:
  55. return false
  56. else:
  57. return false
  58. return true
  59.  
  60.  
  61. function isFurnace2(loc: Location) :: boolean:
  62.  
  63. if block at {_loc} is not blast furnace:
  64. return false
  65.  
  66. set {_layer1::*} to air, brick slab, red brick block, air, red brick block, air, red brick block and brick slab
  67. set {_layer2::*} to air, red brick stair, eastward red brick stair and southward red brick stair
  68. set {_x::*} to 1, 1, 0, -1, -1, -1, 0 and 1
  69. set {_z::*} to 0, 1, 1, 1, 0, -1, -1 and -1
  70.  
  71. #Facing East
  72. set {_base} to -2
  73. 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}:
  74. set {_base} to 0
  75.  
  76. #Facing south
  77. 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}:
  78. set {_base} to 2
  79.  
  80. 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}:
  81. set {_base} to 4
  82.  
  83. 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}:
  84. set {_base} to 6
  85.  
  86. set {_size} to size of {_x::*}
  87. if {_base} is not -2:
  88. set {_baseDefault} to {_base}
  89. loop 7 times:
  90. set {_value} to getNextNumber({_baseDefault}, {_base}, loop-value, {_size})
  91. 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%}:
  92. return false
  93.  
  94.  
  95. set {_base} to {_baseDefault}
  96. if detectStair({_base}, {_loc}):
  97. #set {_current} to 1
  98. #add 1 to {_base}
  99. loop 4 times:
  100. set {_value} to getNextNumber({_baseDefault}, {_base}, (loop-value - 1) * 2, {_size})
  101. 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}
  102. broadcast "%{_layer2::%loop-value%}% -- %block at {_check}%"
  103. if block at {_check} is not {_layer2::%loop-value%}:
  104. return false
  105. else if "%block at {_check}%" starts with "top":
  106. return false
  107. #add 2 to {_current}
  108.  
  109. if block at location 2 meters above {_loc} is not red brick block:
  110. return false
  111. else:
  112. return false
  113. else:
  114. return false
  115. return true
  116.  
  117.  
  118. on rightclick on smooth stone:
  119. if player is not sneaking:
  120. if {anvil.%location of clicked block%} is true:
  121. gui(player)
  122. cancel event
  123.  
  124. on rightclick on cauldron:
  125. if {furnace.%location of event-block%} is true:
  126. if isFurnace1(location 1 meters below clicked block):
  127. cancel event
  128. send "WIP"
  129. else:
  130. delete {furnace.%location of event-block%}
  131.  
  132. on rightclick on blast furnace:
  133. if {furnace2.%location of event-block%} is true:
  134. if isFurnace2(location of clicked block):
  135. cancel event
  136. send "WIP"
  137. else:
  138. delete {furnace2.%location of event-block%}
  139.  
  140. on rightclick holding stone axe:
  141. if clicked block is smooth stone or iron block or diamond block:
  142. if {anvil.%location of event-block%} is not true:
  143. set {anvil.%location of event-block%} to true
  144. set {_tier} to "Tier I"
  145. if clicked block is smooth stone:
  146. set {anvil.%location of event-block%.tier} to 1
  147. else if clicked block is iron block:
  148. set {anvil.%location of event-block%.tier} to 2
  149. set {_tier} to "Tier II"
  150. else:
  151. set {anvil.%location of event-block%.tier} to 3
  152. set {_tier} to "Tier III"
  153.  
  154. set {_s} to 6
  155. loop all players in radius 6 around event-block:
  156. set {_v} to ({_s} - distance between loop-player and event-block)
  157. play sound "block.anvil.place" with volume {_v} and pitch 0 to loop-player
  158.  
  159. send "{@logo} Successfully created an anvil of %{_tier}%."
  160. summon armor stand at location 0.6 meters below event-block
  161. set name of last spawned armor stand to "&7Anvil"
  162. add "{Invisible:1b,NoGravity:1b,NoAI:1b,CustomNameVisible:1}" to NBT of last spawned armor stand
  163.  
  164. summon armor stand at location 0.9 meters below event-block
  165. set name of last spawned armor stand to "&7%{_tier}%"
  166. add "{Invisible:1b,NoGravity:1b,NoAI:1b,CustomNameVisible:1}" to NBT of last spawned armor stand
  167.  
  168. else if clicked block is cauldron:
  169. if isFurnace1(location 1 meters below clicked block):
  170. set {furnace.%location of event-block%} to true
  171.  
  172. else if clicked block is blast furnace:
  173. if isFurnace2(location of clicked block):
  174. set {furnace2.%location of event-block%} to true
  175.  
  176. on break of smooth stone or iron block or diamond block:
  177. if {anvil.%location of event-block%} is true:
  178. set {_s} to 6
  179. loop all players in radius 6 around event-block:
  180. set {_v} to ({_s} - distance between loop-player and event-block)
  181. play sound "block.anvil.place" with volume {_v} and pitch 0 to loop-player
  182. delete {anvil.%location of event-block%}
  183. delete {anvil.%location of event-block%.tier}
  184. loop entities in radius 1 around event-block:
  185. if type of loop-entity is armor stand:
  186. kill loop-entity
  187.  
  188.  
  189. on inventory click:
  190. if type of clicked inventory is chest inventory:
  191. if inventory name of player's current inventory is "&8Anvil":
  192. cancel event
  193.  
  194. command /stair:
  195. trigger:
  196. send "%block 1 meters below player%"
  197.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement