Advertisement
Zeldaboy111

Interface Tier I Furnace ]|[ Skript #341

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