Advertisement
Zeldaboy111

Tier II Furnace detect klaar! ]|[ Skript #338

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