Advertisement
Zeldaboy111

Fuelslot ]|[ Skript #340

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