Zeldaboy111

Fuel ticks ]|[ Skript #342

Aug 30th, 2020
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.59 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. # Returns how many ticks an item gives fuel
  12. function getFuelingTime(type: Item) :: integer:
  13. if {_type} is lava:
  14. return 20000
  15. else if {_type} is block of coal:
  16. return 16000
  17. else if {_type} is dried kelp block:
  18. return 4000
  19. else if {_type} is blaze rod:
  20. return 2400
  21. else if {_type} is coal or charcoal:
  22. return 1600
  23. else if {_type} is any boat or scaffolding:
  24. return 1200
  25. else if {_type} is any log or any planks or any wood slab or oak wood stairs or spruce wood stairs or birch wood stairs or jungle wood stairs or acacia wood stairs or dark oak wood stairs or any wooden button or any wooden trapdoor or any fence gate or any fence or ladder or crafting table or cartography table or fletching table or smithing table or loom or bookshelf or lectern or composter or chest or trapped chest or barrel or daylight detector or jukebox or note block or red mushroom block or brown mushroom block or mushroom stem or banner or bow or fishing rod:
  26. return 300
  27. else if {_type} is any wooden door or any sign or wooden pickaxe or wooden shovel or wooden hoe or wooden axe or wooden sword:
  28. return 200
  29. else if {_type} is bowl or any sapling or stick or any wool:
  30. return 100
  31. else if {_type} is any carpet:
  32. return 67
  33. else if {_type} is bamboo:
  34. return 50
  35. return 0
  36.  
  37. # Returns if the item can be smelted in the furnace, every smelt takes 10 seconds in a normal furnace
  38. function canSmelt(type: Item, tier: Integer) :: boolean:
  39. if {_type} is iron ore or gold ore or lapis ore or redstone ore or coal ore:
  40. return true
  41. else if {_tier} is 2:
  42. if {_type} is diamond ore or emerald ore or nether quartz ore:
  43. return true
  44.  
  45. return false
  46.  
  47. function outlineGui(p: Player):
  48. loop 9 times:
  49. set slot loop-value - 1 of {_p}'s current inventory to gray stained glass pane named "&8"
  50. set slot 54-loop-value of {_p}'s current inventory to gray stained glass pane named "&8"
  51.  
  52. loop 5 times:
  53. set slot loop-value * 9 of {_p}'s current inventory to gray stained glass pane named "&8"
  54. set slot loop-value * 9-1 of {_p}'s current inventory to gray stained glass pane named "&8"
  55.  
  56. function openGuiOutlined(p: Player, loc: Location, rows: integer, name: String):
  57. open chest with {_rows} rows named {_name} to {_p}
  58. set {inventory.%{_p}%.name} to uncolored {_name}
  59. set {inventory.%{_p}%.current} to {_loc}
  60. add {_p} to {inventoryList.%{_loc}%.%{inventory.%{_p}%.name}%::*}
  61. wait 2 ticks
  62. outlineGui({_p})
  63.  
  64. #function gui(p: Player):
  65. # openGuiOutlined({_p}, 6, "&8Anvil")
  66. #subcategorie armor -> alle armor die je kan maken laten zien
  67.  
  68. function guiFurnace1(p: Player, loc: Location):
  69. openGuiOutlined({_p}, {_loc}, 6, "&8Furnace")
  70.  
  71. if {furnace1.%{_loc}%.contents.fuel} is not set:
  72. set {furnace1.%{_loc}%.contents.fuel} to 0
  73. if {furnace1.%{_loc}%.contents.ore} is not set:
  74. set {furnace1.%{_loc}%.contents.ore} to 0
  75. if {furnace1.%{_loc}%.contents.ingot} is not set:
  76. set {furnace1.%{_loc}%.contents.ingot} to 0
  77.  
  78. if {furnace1.%{_loc}%.contents.ingotType} is not set:
  79. set {furnace1.%{_loc}%.contents.ingot} to 0
  80. if {furnace1.%{_loc}%.contents.oreType} is not set:
  81. set {furnace1.%{_loc}%.contents.ore} to 0
  82. if {furnace1.%{_loc}%.contents.fuelType} is not set:
  83. set {furnace1.%{_loc}%.contents.fuel} to 0
  84.  
  85. set slot 38 of {_p}'s current inventory to lime stained glass pane named "&a&lOre"
  86. set slot 40 of {_p}'s current inventory to lime stained glass pane named "&a&lFuel"
  87. set slot 42 of {_p}'s current inventory to lime stained glass pane named "&a&lIngot"
  88.  
  89. if {furnace1.%{_loc}%.contents.ore} > 0:
  90. set slot 38 of {_p}'s current inventory to ("%{furnace1.%{_loc}%.contents.ore}% %{furnace1.%{_loc}%.contents.fuelType}%" parsed as an item)
  91.  
  92. if {furnace1.%{_loc}%.contents.fuel} > 0:
  93. set slot 40 of {_p}'s current inventory to ("%{furnace1.%{_loc}%.contents.fuel}% %{furnace1.%{_loc}%.contents.fuelType}%" parsed as an item)
  94.  
  95. if {furnace1.%{_loc}%.contents.ingot} > 0:
  96. set slot 42 of {_p}'s current inventory to ("%{furnace1.%{_loc}%.contents.ingot}% %{furnace1.%{_loc}%.contents.ingotType}%" parsed as an item)
  97.  
  98. #Slot for ore
  99.  
  100. #Slot for ingot
  101.  
  102. # loop for the cooking -- use states
  103.  
  104. loop 5 times:
  105. set slot 19 + loop-value of {_p}'s current inventory to gray stained glass pane named "&f0%%"
  106.  
  107.  
  108.  
  109. # U T I L I T I E S
  110.  
  111. function getNextNumber(base: number, addToDefault: number, max: number) :: number:
  112. set {_value} to {_base} + {_addToDefault}
  113. if {_value} > {_max}:
  114. set {_value} to {_addToDefault} - ({_max} - {_base})
  115.  
  116. return {_value}
  117.  
  118. function detectStair(facing: number, loc: Location, startValue: String) :: boolean:
  119. set {_list::*} to "westward red brick stair", "red brick stair", "eastward red brick stair" and "southward red brick stair"
  120. set {_dir} to {_facing}/2 + 1
  121.  
  122. if {_dir} > 4:
  123. remove 4 from {_dir}
  124.  
  125. if "%block at location of {_loc}%" is "%{_startValue}%%{_list::%{_dir}%}%":
  126. return true
  127. return false
  128.  
  129.  
  130. # F U R N A C E D E T E C T S
  131.  
  132. function isFurnace1(below: Location) :: boolean:
  133. if block at {_below} is campfire:
  134. set {_xAdjust::*} to 1, 1, 1, 0, 0, -1, -1 and -1
  135. set {_zAdjust::*} to 1, 0, -1, 1, -1, 1, 0 and -1
  136. loop 8 times:
  137. 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}
  138. if block at {_checkLoc} is not red brick block:
  139. return false
  140. else:
  141. return false
  142. return true
  143.  
  144.  
  145. function isFurnace2(loc: Location) :: boolean:
  146. if block at {_loc} is not blast furnace:
  147. return false
  148.  
  149. set {_layer1::*} to air, brick slab, red brick block, air, red brick block, air, red brick block and brick slab
  150. set {_layer2::*} to air, red brick stair, eastward red brick stair and southward red brick stair
  151. set {_x::*} to 1, 1, 0, -1, -1, -1, 0 and 1
  152. set {_z::*} to 0, 1, 1, 1, 0, -1, -1 and -1
  153.  
  154. set {_base} to -2
  155. 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}:
  156. set {_base} to 0
  157.  
  158. 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}:
  159. set {_base} to 2
  160.  
  161. 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}:
  162. set {_base} to 4
  163.  
  164. 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}:
  165. set {_base} to 6
  166.  
  167. set {_size} to size of {_x::*}
  168. if {_base} is not -2:
  169. loop 7 times:
  170. set {_value} to getNextNumber({_base}, loop-value, {_size})
  171. 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%}:
  172. return false
  173.  
  174.  
  175. set {_facingAdjust::*} to 0, 4, 6 and 8
  176. if detectStair({_base}, location 1 meters above {_loc}, "top "):
  177. loop 4 times:
  178. set {_value} to getNextNumber({_base}, loop-value*2, {_size}) - 1
  179. 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}
  180. set {_facing} to {_base}
  181. if {_facing} - {_facingAdjust::%loop-value%} >= 2:
  182. remove {_facingAdjust::%loop-value%} from {_facing}
  183. else:
  184. add {_facingAdjust::%loop-value%} to {_facing}
  185.  
  186. if loop-value is 1:
  187. if block at {_check} is not {_layer2::%loop-value%}:
  188. return false
  189. else if detectStair({_facing} - 2, {_check}, "") is false:
  190. return false
  191.  
  192. if block at location 2 meters above {_loc} is not red brick block:
  193. return false
  194. else:
  195. return false
  196. else:
  197. return false
  198. return true
  199.  
  200. # C L I C K E V E N T S
  201.  
  202. on rightclick on smooth stone:
  203. if player is not sneaking:
  204. if {anvil.%location of clicked block%} is true:
  205. #gui(player)
  206. cancel event
  207.  
  208. on rightclick on cauldron:
  209. if {furnace.%location of event-block%} is true:
  210. if isFurnace1(location 1 meters below clicked block):
  211. cancel event
  212. guiFurnace1(player, location of clicked block)
  213.  
  214. else:
  215. delete {furnace1.%location of clicked block%.contents.fuel}
  216. delete {furnace1.%location of clicked block%.contents.ore}
  217. delete {furnace1.%location of clicked block%.contents.ingot}
  218. delete {furnace.%location of event-block%}
  219.  
  220. on rightclick on blast furnace:
  221. if {furnace2.%location of event-block%} is true:
  222. if isFurnace2(location of clicked block):
  223. cancel event
  224. send "WIP"
  225. else:
  226. delete {furnace2.%location of event-block%}
  227.  
  228. on rightclick holding stone axe:
  229. if clicked block is smooth stone or iron block or diamond block:
  230. if {anvil.%location of event-block%} is not true:
  231. set {anvil.%location of event-block%} to true
  232. set {_tier} to "Tier I"
  233. if clicked block is smooth stone:
  234. set {anvil.%location of event-block%.tier} to 1
  235. else if clicked block is iron block:
  236. set {anvil.%location of event-block%.tier} to 2
  237. set {_tier} to "Tier II"
  238. else:
  239. set {anvil.%location of event-block%.tier} to 3
  240. set {_tier} to "Tier III"
  241.  
  242. set {_s} to 6
  243. loop all players in radius 6 around event-block:
  244. set {_v} to ({_s} - distance between loop-player and event-block)
  245. play sound "block.anvil.place" with volume {_v} and pitch 0 to loop-player
  246.  
  247. send "{@logo} Successfully created an anvil of %{_tier}%."
  248. summon armor stand at location 0.6 meters below event-block
  249. set name of last spawned armor stand to "&7Anvil"
  250. add "{Invisible:1b,NoGravity:1b,NoAI:1b,CustomNameVisible:1}" to NBT of last spawned armor stand
  251.  
  252. summon armor stand at location 0.9 meters below event-block
  253. set name of last spawned armor stand to "&7%{_tier}%"
  254. add "{Invisible:1b,NoGravity:1b,NoAI:1b,CustomNameVisible:1}" to NBT of last spawned armor stand
  255.  
  256. else if clicked block is cauldron:
  257. if {furnace.%location of event-block%} is not true:
  258. if isFurnace1(location 1 meters below clicked block):
  259. set {furnace.%location of event-block%} to true
  260. cancel event
  261.  
  262. else if clicked block is blast furnace:
  263. if {furnace.%location of event-block%} is not true:
  264. if isFurnace2(location of clicked block):
  265. set {furnace2.%location of event-block%} to true
  266. cancel event
  267. send "WIP"
  268.  
  269. on break of smooth stone or iron block or diamond block:
  270. if {anvil.%location of event-block%} is true:
  271. set {_s} to 6
  272. loop all players in radius 6 around event-block:
  273. set {_v} to ({_s} - distance between loop-player and event-block)
  274. play sound "block.anvil.place" with volume {_v} and pitch 0 to loop-player
  275. delete {anvil.%location of event-block%}
  276. delete {anvil.%location of event-block%.tier}
  277. loop entities in radius 1 around event-block:
  278. if type of loop-entity is armor stand:
  279. kill loop-entity
  280.  
  281.  
  282. on inventory click:
  283. if type of clicked inventory is chest inventory:
  284. if inventory name of player's current inventory is "&8Anvil":
  285. cancel event
  286.  
  287. else if inventory name of player's current inventory is "&8Furnace":
  288. cancel event
  289. #ore type
  290. #fuel type
  291.  
  292. on inventory close:
  293. if {inventory.%player%.name} is set:
  294. remove player from {inventoryList.%{inventory.%player%.current}%.%{inventory.%player%.name}%::*}
  295. delete {inventory.%player%.name}
  296. delete {inventory.%player%.current}
  297.  
  298. #Cancel in crafting table or below
  299. #register new shaped recipe for air using iron ingot, air, iron ingot, iron ingot, chest, iron ingot, air, iron ingot, air
  300.  
Advertisement
Add Comment
Please, Sign In to add comment