Zeldaboy111

Blacksmith af! ]|[ Skript #397

Mar 11th, 2021 (edited)
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 42.68 KB | None | 0 0
  1. #©
  2. #- Reselling/Reuploading while claiming that it is yours or made by you is disallowed
  3. #- Do not edit it and upload it as your own
  4. #- While using it in a video, please feature everything under "Video"
  5. #©
  6. #
  7. #Video:
  8. #Skript made by Zeldaboy111
  9. #More content of the creator: https://forums.skunity.com/search/26443679/
  10.  
  11. options:
  12. logo: &6&lBS&8:&7
  13. tier1Furnace: "&8Furnace I"
  14. tier2Furnace: "&8Furnace II"
  15. permission: "blacksmith"
  16.  
  17. on disable:
  18. if {furnace1.looping} is true:
  19. set {furnace1.looping} to false
  20. set {furnace1.loopStopped} to true
  21.  
  22. on enable:
  23. set {blacksmith.cost.helmet} to 5
  24. set {blacksmith.cost.chestplate} to 8
  25. set {blacksmith.cost.leggings} to 7
  26. set {blacksmith.cost.boots} to 4
  27. set {blacksmith.anvilGui.inventoryName::*} to "Anvil Tier I", "Anvil Tier II" and "Anvil Tier III"
  28. set {blacksmith.anvilGui.craftMaterialOrder::*} to "Chain", "Golden", "Iron" and "Diamond"
  29. set {blacksmith.anvilGui.materialOrder::*} to iron nugget, golden ingot, iron ingot and diamond
  30. set {blacksmith.anvilGui.materialColorList::*} to "&f", "&6", "&f" and "&b"
  31. set {blacksmith.anvilGui.materialNameList::*} to "%{blacksmith.anvilGui.materialColorList::1}%Chain", "%{blacksmith.anvilGui.materialColorList::2}%Gold", "%{blacksmith.anvilGui.materialColorList::3}%Iron" and "%{blacksmith.anvilGui.materialColorList::4}%Diamond"
  32. if {blacksmith.advancedMode} is not set:
  33. set {blacksmith.advancedMode} to true
  34. wait 1 second
  35. if {furnace1.loopStopped} is true:
  36. set {furnace1.looping} to true
  37. loop_furnace1()
  38. set {furnace1.loopStopped} to false
  39.  
  40. # ||=============================================================||
  41. # || _____ ____ __ __ __ __ _ _ _____ ||
  42. # || / ____/ __ \| \/ | \/ | /\ | \ | | __ \ ||
  43. # || | | | | | | \ / | \ / | / \ | \| | | | | ||
  44. # || | | | | | | |\/| | |\/| | / /\ \ | . ` | | | | ||
  45. # || | |___| |__| | | | | | | |/ ____ \| |\ | |__| | ||
  46. # || \_____\____/|_| |_|_| |_/_/ \_\_| \_|_____/ ||
  47. # || ||
  48. # ||=============================================================||
  49.  
  50.  
  51. command /blacksmith [<text>] [<text>]:
  52. aliases: /bs
  53. trigger:
  54. if player doesn't have permission {@permission}:
  55. send "{@logo} You do not have enough permissions to do this!"
  56. else:
  57. if arg-1 is "advanced":
  58. if arg-2 is "true" or "enable":
  59. if {blacksmith.advancedMode} is true:
  60. send "{@logo} The &eadvanced mode &7is already enabled."
  61. else:
  62. set {blacksmith.advancedMode} to true
  63. send "{@logo} You have enabled the &eadvanced mode&7."
  64. else if arg-2 is "false" or "disable":
  65. if {blacksmith.advancedMode} is false:
  66. send "{@logo} The &eadvanced mode &7is already disabled."
  67. else:
  68. set {blacksmith.advancedMode} to false
  69. send "{@logo} You have disabled the &eadvanced mode&7."
  70. else:
  71. send "{@logo} Incorrect usage! &e/blacksmith advanced <true | false>&7."
  72. else:
  73. send "{@logo} Incorrect usage! &e/blacksmith advanced <true | false>&7."
  74.  
  75.  
  76.  
  77. #||==============================================================||
  78. #|| _____ ______ _ _ ______ _____ _ ||
  79. #|| / ____| ____| \ | | ____| __ \ /\ | | ||
  80. #|| | | __| |__ | \| | |__ | |__) | / \ | | ||
  81. #|| | | |_ | __| | . ` | __| | _ / / /\ \ | | ||
  82. #|| | |__| | |____| |\ | |____| | \ \ / ____ \| |____ ||
  83. #|| \_____|______|_| \_|______|_| \_\/_/ \_\______| ||
  84. #|| ||
  85. #||==============================================================||
  86. function outlineGui(player: Player):
  87. set {_size} to inventory size of {_player}'s current inventory
  88. loop 9 times:
  89. set slot loop-value - 1 of {_player}'s current inventory to gray stained glass pane named "&7"
  90. set slot {_size} - loop-value of {_player}'s current inventory to gray stained glass pane named "&7"
  91. loop {_size}/9 times:
  92. set slot loop-value * 9 of {_player}'s current inventory to gray stained glass pane named "&7"
  93. set slot loop-value * 9 -1 of {_player}'s current inventory to gray stained glass pane named "&7"
  94.  
  95. function openGuiWithOutline(player: Player, loc: Location, rows: Number, name: String):
  96. open chest with {_rows} rows named {_name} to {_player}
  97. set {inventory.%{_player}%.name} to uncolored {_name}
  98. set {inventory.%{_player}%.current} to {_loc}
  99. wait 2 ticks
  100. outlineGui({_player})
  101.  
  102. function openAnvilGui(player: Player):
  103. open chest with 5 rows named {blacksmith.anvilGui.inventoryName::%{anvil.current.%{_player}%}%} to {_player}
  104. outlineGui({_player})
  105. wait 2 ticks
  106. set {_startAt} to 20 - {anvil.current.%{_player}%}
  107. loop 1+{anvil.current.%{_player}%} times:
  108. set slot {_startAt}+loop-value*2 of {_player}'s current inventory to {blacksmith.anvilGui.materialOrder::%loop-value%} named {blacksmith.anvilGui.materialNameList::%loop-value%}
  109.  
  110. function openAnvilCraftGui(player: Player, materialId: integer):
  111. open chest with 5 rows named {blacksmith.anvilGui.inventoryName::%{anvil.current.%{_player}%}%} to {_player}
  112. outlineGui({_player})
  113. wait 2 ticks
  114. setArmorInSlot({_player}, 20, {_materialId})
  115.  
  116. function setArmorInSlot(player: Player, slot: int, armorSetId: int):
  117. # Set to variables to make the lines shorter and clearer.
  118. set {_material} to {blacksmith.anvilGui.craftMaterialOrder::%{_armorSetId}%}
  119. set {_color} to {blacksmith.anvilGui.materialColorList::%{_armorSetId}%}
  120. set {_craftingMaterial} to {blacksmith.anvilGui.materialNameList::%{_armorSetId}%}
  121. set {_helmet} to ("%{_material}% helmet" parsed as an item)
  122. set slot {_slot} of {_player}'s current inventory to ("%{_material}% helmet" parsed as an item) named "%{_color}%%{_material}% Helmet" with lore "&8" and "&7Cost&8: %{_color}%5 %{_craftingMaterial}%" without any NBT
  123. set slot {_slot}+1 of {_player}'s current inventory to ("%{_material}% chestplate" parsed as an item) named "%{_color}%%{_material}% Chestplate" with lore "&8" and "&7Cost&8: %{_color}%8 %{_craftingMaterial}%" without any NBT
  124. set slot {_slot}+3 of {_player}'s current inventory to ("%{_material}% leggings" parsed as an item) named "%{_color}%%{_material}% Leggings" with lore "&8" and "&7Cost&8: %{_color}%7 %{_craftingMaterial}%" without any NBT
  125. set slot {_slot}+4 of {_player}'s current inventory to ("%{_material}% boots" parsed as an item) named "%{_color}%%{_material}% Boots" with lore "&8" and "&7Cost&8: %{_color}%4 %{_craftingMaterial}%" without any NBT
  126. # Add crafting recipies & click checks for these items
  127. if {_material} is not "chain":
  128. set slot {_slot}+9 of {_player}'s current inventory to ("%{_material}% sword" parsed as an item) named "%{_color}%%{_material}% Sword" with lore "&8" and "&7Cost&8: %{_color}%2 %{_craftingMaterial}% Sword"
  129. set slot {_slot}+10 of {_player}'s current inventory to ("%{_material}% pickaxe" parsed as an item) named "%{_color}%%{_material}% Pickaxe" with lore "&8" and "&7Cost&8: %{_color}%2 %{_craftingMaterial}% Pickaxe"
  130. set slot {_slot}+11 of {_player}'s current inventory to ("%{_material}% axe" parsed as an item) named "%{_color}%%{_material}% Axe" with lore "&8" and "&7Cost&8: %{_color}%2 %{_craftingMaterial}% Axe"
  131. set slot {_slot}+12 of {_player}'s current inventory to ("%{_material}% shovel" parsed as an item) named "%{_color}%%{_material}% Shovel" with lore "&8" and "&7Cost&8: %{_color}%2 %{_craftingMaterial}% Shovel"
  132. set slot {_slot}+13 of {_player}'s current inventory to ("%{_material}% hoe" parsed as an item) named "%{_color}%%{_material}% Hoe" with lore "&8" and "&7Cost&8: %{_color}%2 %{_craftingMaterial}% Hoe"
  133.  
  134. function openAnvilGui_1(player: Player):
  135. open chest with 6 rows named "Anvil Tier I" to {_player}
  136. wait 2 ticks
  137. outlineGui({_player})
  138. function openAnvilGui_2(player: Player):
  139. open chest with 6 rows named "Anvil Tier II" to {_player}
  140. wait 2 ticks
  141. outlineGui({_player})
  142.  
  143. function openAnvilGui_3(player: Player):
  144. open chest with 6 rows named "Anvil Tier III" to {_player}
  145. wait 2 ticks
  146. outlineGui({_player})
  147.  
  148.  
  149. function removeItemFromPlayer(player: Player, item: Item, amount: Number):
  150. if {_amount} > 0:
  151. if {_item} is set:
  152. if gamemode of {_player} is survival or adventure:
  153. remove "%{_amount}% %{_item}%" parsed as an item from {_player}'s inventory
  154.  
  155.  
  156. #||===============================================||
  157. #|| _ ___ _______ _ ||
  158. #|| /\ | \ | \ \ / /_ _| | ||
  159. #|| / \ | \| |\ \ / / | | | | ||
  160. #|| / /\ \ | . ` | \ \/ / | | | | ||
  161. #|| / ____ \| |\ | \ / _| |_| |____ ||
  162. #|| /_/ \_\_| \_| \/ |_____|______| ||
  163. #|| ||
  164. #||===============================================||
  165.  
  166. function getRecipeItemFromType(type: String) :: item:
  167. if {_type} is "chain":
  168. return "iron nugget" parsed as an item
  169. else if {_type} is "diamond":
  170. return "diamond" parsed as an item
  171. return "%{_type}% ingot" parsed as an item
  172.  
  173. function tryCraftArmour(player: Player, type: String, piece: String):
  174. if {_player}'s gamemode is spectator:
  175. stop
  176.  
  177. set {_result} to "%{_type}% %{_piece}%" parsed as an item
  178. set {_recipeItem} to getRecipeItemFromType({_type})
  179. set {_recipeAmount} to {blacksmith.cost.%{_piece}%}
  180. set {_recipeAmountFromPlayer} to amount of {_recipeItem} in {_player}'s inventory
  181. if {_player}'s gamemode is survival or adventure:
  182. if {_recipeAmountFromPlayer} < {_recipeAmount}:
  183. play "ENTITY_ITEM_BREAK" to {_player} at volume 10
  184. stop
  185.  
  186. if {blacksmith.advancedMode} is false:
  187. give {_result} to {_player}
  188. removeItemFromPlayer({_player}, {_recipeItem}, {_recipeAmount})
  189. play sound "block.anvil.use" with volume 10 and pitch 1 to {_player}
  190. else:
  191. playBlacksmithMinigame({_player}, {_recipeItem}, {_recipeAmount}, {_result})
  192.  
  193. function playBlacksmithMinigame(player: Player, costItem: Item, cost: Number, result: Item):
  194. set {blacksmith.smithing.%{_player}%.costItem} to {_costItem}
  195. set {blacksmith.smithing.%{_player}%.cost} to {_cost}
  196. set {blacksmith.smithing.%{_player}%.result} to {_result}
  197. set {blacksmith.smithing.%{_player}%.chainmail} to false
  198. set {blacksmith.smithing.%{_player}%.stage} to 0
  199.  
  200. open chest with 6 rows named "Smithing" to {_player}
  201. outlineGui({_player})
  202. set {_result1} to "%type of {_result}%"
  203. if {_result1} contains "chain":
  204. playMinigame_chain({_player})
  205. else:
  206. setSmithingGui({_player})
  207.  
  208. function playMinigame_chain(player: Player):
  209. set {inventory.%{_player}%.name} to uncolored "Smithing"
  210. set {blacksmith.smithing.%{_player}%.chainmail} to true
  211. set {_random::*} to 39 and 41
  212. set {_slot} to random element out of {_random::*}
  213. remove {_slot} from {_random::*}
  214. set {_slot1} to random element out of {_random::*}
  215.  
  216. set {_resultMaterial} to "%type of {blacksmith.smithing.%{_player}%.result}%"
  217. set slot {_slot} of {_player}'s current inventory to iron nugget named "&fCreate Rings" without any NBT
  218. set slot {_slot1} of {_player}'s current inventory to iron hoe named "&fJoin Rings" without any NBT
  219. set slot 22 of {_player}'s current inventory to iron nugget named "&a&lCreate Rings" with lore "&7", "&7Click the corresponding item" and "&7to continue crafting."
  220. set slot 13 of {_player}'s current inventory to {_result} named "&f&n%first character of {_resultMaterial} in upper case%%last (length of {_resultMaterial}-1) characters of {_resultMaterial} in lower case%" without any NBT
  221.  
  222. function setSmithingGui(player: Player):
  223. set {blacksmith.smithing.%{_player}%.chainmail} to false
  224. set {blacksmith.smithing.%{_player}%.stage} to 0
  225. set {inventory.%{_player}%.name} to uncolored "Smithing II"
  226.  
  227. open chest with 6 rows named "Smithing" to {_player}
  228. outlineGui({_player})
  229. set {_result1} to "%type of {blacksmith.smithing.%{_player}%.result}%"
  230. #set slot 22 of {_player}'s current inventory to iron ingot named "&a&lBend" with lore "&7", "&7Click the corresponding item" and "&7to continue crafting."
  231. set slot 22 of {_player}'s current inventory to iron pressure plate named "&a&lDraw" with lore "&7", "&7Click the corresponding item" and "&7to continue crafting."
  232. set slot 13 of {_player}'s current inventory to {blacksmith.smithing.%{_player}%.result} named "&f&n%first character of {_result1} in upper case%%last (length of {_result1}-1) characters of {_result1} in lower case%" without any NBT
  233.  
  234. set {_random::*} to 38, 39, 41 and 42
  235. set {_slot} to random element out of {_random::*}
  236. remove {_slot} from {_random::*}
  237. set {_slot1} to random element out of {_random::*}
  238. remove {_slot1} from {_random::*}
  239. set {_slot2} to random element out of {_random::*}
  240. remove {_slot2} from {_random::*}
  241. set {_slot3} to random element out of {_random::*}
  242.  
  243. set slot {_slot} of {_player}'s current inventory to iron ingot named "&fBend" without any NBT
  244. set slot {_slot1} of {_player}'s current inventory to iron axe named "&fHammer" without any NBT
  245. set slot {_slot2} of {_player}'s current inventory to water bucket named "&fCool" without any NBT
  246. set slot {_slot3} of {_player}'s current inventory to iron pressure plate named "&fDraw" without any NBT
  247.  
  248. #gui 1: choose material to work with
  249. #gui 2: choose armour/tool to craft
  250. # Note: disable crafting of tools :)
  251.  
  252. function userFailedMinigame(player: Player):
  253. removeItemFromPlayer({_player}, {blacksmith.smithing.%{_player}%.costItem}, {blacksmith.smithing.%{_player}%.cost})
  254. play sound "entity.item.break" with volume 10 and pitch 1 to {_player}
  255. close {_player}'s inventory
  256.  
  257.  
  258.  
  259. #||=============================================================||
  260. #|| ______ _ _ _____ _ _ _____ ______ ||
  261. #|| | ____| | | | __ \| \ | | /\ / ____| ____| ||
  262. #|| | |__ | | | | |__) | \| | / \ | | | |__ ||
  263. #|| | __| | | | | _ /| . ` | / /\ \| | | __| ||
  264. #|| | | | |__| | | \ \| |\ |/ ____ \ |____| |____ ||
  265. #|| |_| \____/|_| \_\_| \_/_/ \_\_____|______| ||
  266. #|| ||
  267. #||=============================================================||
  268. function getFuelingTime(type: item) :: integer:
  269. if type of {_type} = lava bucket:
  270. return 20000
  271. else if type of {_type} = coal block:
  272. return 16000
  273. else if type of {_type} = dried kelp block:
  274. return 4000
  275. else if type of {_type} = blaze rod:
  276. return 2400
  277. else if type of {_type} = coal or charcoal:
  278. return 1600
  279. else if type of {_type} = any boat or scaffolding:
  280. return 1200
  281. else if type of {_type} = 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:
  282. return 300
  283. else if type of {_type} = any wooden door or any sign or wooden pickaxe or wooden shovel or wooden hoe or wooden axe or wooden sword:
  284. return 200
  285. else if type of {_type} = bowl or any sapling or stick or any wool:
  286. return 100
  287. else if type of {_type} = any carpet:
  288. return 67
  289. else if type of {_type} = bamboo:
  290. return 50
  291. return 0
  292.  
  293. # Returns if the item can be smelted in the furnace, every smelt takes 10 seconds in a normal furnace
  294. function canSmelt(type: Item, tier: Integer) :: boolean:
  295. if type of {_type} is iron ore or gold ore or lapis ore or redstone ore or coal ore:
  296. return true
  297. else if {_tier} is 2:
  298. if type of {_type} is diamond ore or emerald ore or nether quartz ore:
  299. return true
  300.  
  301. return false
  302.  
  303. function canSmeltInFurnace(p: Player, item: Item) :: boolean:
  304. set {_furnaceId} to {inventory.%{_p}%.current}
  305. if {furnace1.%{_furnaceId}%.contents.oreType} is set:
  306. if "%type of {_item}%" is not "%{furnace1.%{_furnaceId}%.contents.oreType}%":
  307. return false
  308. if {furnace1.%{_furnaceId}%.contents.ingotType} is set:
  309. if type of {_item} is coal ore:
  310. if type of {furnace1.%{_furnaceId}%.contents.ingotType} is coal:
  311. return true
  312. set {_item} to "%type of {_item}%"
  313. replace all " ore" in {_item} with " ingot"
  314. if {_item} is not "%{furnace1.%{_furnaceId}%.contents.ingotType}%":
  315. return false
  316. return true
  317.  
  318.  
  319. function isFurnace1(below: Location) :: boolean:
  320. if block at {_below} is campfire:
  321. set {_xAdjust::*} to 1, 1, 1, 0, 0, -1, -1 and -1
  322. set {_zAdjust::*} to 1, 0, -1, 1, -1, 1, 0 and -1
  323. loop 8 times:
  324. 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}
  325. if block at {_checkLoc} is not red brick block:
  326. return false
  327. else:
  328. return false
  329. return true
  330.  
  331. function getStartDirection(loc: location, x: numbers, z: numbers, layer1: items) :: number:
  332. set {_dirNumber} to 1
  333. loop 4 times:
  334. if block at location at x-coordinate of {_loc} + {_x::%{_dirNumber}%}, y-coordinate of {_loc}, z-coordinate of {_loc} + {_z::%{_dirNumber}%} in world of {_loc} is {_layer1::1}:
  335. return ({_dirNumber} - 1)
  336. add 2 to {_dirNumber}
  337. return -2
  338.  
  339. function isFurnace2(loc: Location) :: boolean:
  340. set {_layer1::*} to air, brick slab, red brick block, air, red brick block, air, red brick block and brick slab
  341. set {_layer2::*} to air, red brick stair, eastward red brick stair and southward red brick stair
  342. set {_x::*} to 1, 1, 0, -1, -1, -1, 0 and 1
  343. set {_z::*} to 0, 1, 1, 1, 0, -1, -1 and -1
  344.  
  345. set {_startDirection} to getStartDirection({_loc}, {_x::*}, {_z::*}, {_layer1::*})
  346. set {_size} to size of {_x::*}
  347.  
  348. if {_startDirection} is -2:
  349. return false
  350.  
  351. loop 7 times:
  352. set {_checkDirection} to getNextCheckingDirection({_startDirection}, loop-value, {_size})
  353. if block at location at x-coordinate of {_loc} + {_x::%{_checkDirection}%}, y-coordinate of {_loc}, z-coordinate of {_loc} + {_z::%{_checkDirection}%} in world of {_loc} is not {_layer1::%loop-value%}:
  354. return false
  355.  
  356. set {_facingAdjust::*} to 0, 4, 6 and 8
  357. if checkIfBlockIsStair({_startDirection}, location 1 meters above {_loc}, "top "):
  358. loop 4 times:
  359. set {_value} to getNextCheckingDirection({_startDirection}, loop-value*2, {_size}) - 1
  360. 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}
  361. set {_facing} to {_startDirection}
  362. if {_facing} - {_facingAdjust::%loop-value%} >= 2:
  363. remove {_facingAdjust::%loop-value%} from {_facing}
  364. else:
  365. add {_facingAdjust::%loop-value%} to {_facing}
  366.  
  367. if loop-value is 1:
  368. if block at {_check} is not {_layer2::%loop-value%}:
  369. return false
  370. else if checkIfBlockIsStair({_facing} - 2, {_check}, "") is false:
  371. return false
  372.  
  373. if block at location 2 meters above {_loc} is not red brick block:
  374. return false
  375. else:
  376. return false
  377. return true
  378.  
  379. function getNextCheckingDirection(startDirection: Number, addToDefault: Number, max: Number) :: number:
  380. set {_value} to {_startDirection}+{_addToDefault}
  381. if {_value} > {_max}:
  382. set {_value} to {_addToDefault} - ({_max}-{_startDirection})
  383. return {_value}
  384. function checkIfBlockIsStair(direction: Number, loc: Location, startValue: String) :: boolean:
  385. set {_list::*} to "westward red brick stair", "red brick stair", "eastward red brick stair" and "southward red brick stair"
  386. set {_dir} to {_direction}/2+1
  387. if {_dir} > 4:
  388. set {_dir} to ({_direction}/2)-3
  389. if "%block at location of {_loc}%" is "%{_startValue}%%{_list::%{_dir}%}%":
  390. return true
  391. return false
  392.  
  393. function setSlotInInventory(p: Player, slot: Number, tierNumber: Integer, loc: Location, type: String):
  394. set slot {_slot} of {_p}'s current inventory to lime stained glass pane named "&a&l%{_type}%"
  395. set {_type} to {_type} in lower case
  396. if {furnace%{_tierNumber}%.%{_loc}%.contents.%{_type}%} > 0:
  397. set slot {_slot} of {_p}'s current inventory to ("%{furnace%{_tierNumber}%.%{_loc}%.contents.%{_type}%}% %{furnace%{_tierNumber}%.%{_loc}%.contents.%{_type}%Type}%" parsed as an item)
  398.  
  399. function guiFurnace(p: Player, loc: Location, name: String, tier: String):
  400. openGuiWithOutline({_p}, {_loc}, 6, {_name})
  401. set {_tierNumber} to getTierNumber({_tier})
  402. add {_p} to {inventoryList.%{_loc}%.furnace %{_tier}%::*}
  403.  
  404. if {furnace%{_tierNumber}%.%{_loc}%.contents.ingotType} is not set:
  405. set {furnace%{_tierNumber}%.%{_loc}%.contents.ingot} to 0
  406. if {furnace%{_tierNumber}%.%{_loc}%.contents.oreType} is not set:
  407. set {furnace%{_tierNumber}%.%{_loc}%.contents.ore} to 0
  408. if {furnace%{_tierNumber}%.%{_loc}%.contents.fuelType} is not set:
  409. set {furnace%{_tierNumber}%.%{_loc}%.contents.fuel} to 0
  410.  
  411. set {inventory.%{_p}%.tier} to {_tier}
  412. set {inventory.%{_p}%.tierNumber} to {_tierNumber}
  413. if {furnace%{_tierNumber}%.%{_loc}%.contents.fuelType} is set:
  414. if {furnace%{_tierNumber}%.%{_loc}%.fuelingTimeMax} is not set:
  415. set {furnace%{_tierNumber}%.%{_loc}%.fuelingTimeMax} to getFuelingTime({furnace%{_tierNumber}%.%{_loc}%.contents.fuelType}) / 20
  416. if {_tier} is "II":
  417. set {furnace%{_tierNumber}%.%{_loc}%.fuelingTimeMax} to {furnace%{_tierNumber}%.%{_loc}%.fuelingTimeMax}*1.05
  418.  
  419. setSlotInInventory({_p}, 38, {_tierNumber}, {_loc}, "Ore")
  420. setSlotInInventory({_p}, 40, {_tierNumber}, {_loc}, "Fuel")
  421. setSlotInInventory({_p}, 42, {_tierNumber}, {_loc}, "Ingot")
  422. loop 5 times:
  423. set slot 19 + loop-value of {_p}'s current inventory to gray stained glass pane named "&f%20*loop-value%%%"
  424. updateInventoryFuelIndicator({_loc}, {furnace%{_tierNumber}%.%{_loc}%.smeltTime}, " %{_tier}%")
  425.  
  426. function guiFurnace1(p: Player, loc: Location):
  427. guiFurnace({_p}, {_loc}, {@tier1Furnace}, "I")
  428. function guiFurnace2(p: Player, loc: Location):
  429. guiFurnace({_p}, {_loc}, {@tier2Furnace}, "II")
  430.  
  431. function getTierNumber(tier: String) :: Integer:
  432. replace all " " in {_tier} with ""
  433. if {_tier} is "I":
  434. return 1
  435. return 2
  436.  
  437. function updateItemInFurnace(player: Player, item: item, typeLower: String, leftClick: Boolean) :: item:
  438. if {_leftClick} is false:
  439. add 1 to {furnace%{inventory.%{_player}%.tierNumber}%.%{inventory.%{_player}%.current}%.contents.%{_typeLower}%}
  440. set {furnace%{inventory.%{_player}%.tierNumber}%.%{inventory.%{_player}%.current}%.contents.%{_typeLower}%Type} to "%type of {_item}%"
  441. set {_item} to "%item amount of {_item} - 1% %type of {_item}%" parsed as an item
  442. else:
  443. if {furnace%{inventory.%{_player}%.tierNumber}%.%{inventory.%{_player}%.current}%.contents.%{_typeLower}%} + item amount of {_item} > 64:
  444. set {_item} to "%(item amount of {_item} - (64 - {furnace%{inventory.%{_player}%.tierNumber}%.%{inventory.%{_player}%.current}%.contents.%{_typeLower}%}))% %type of {_item}%"
  445. set {furnace%{inventory.%{_player}%.tierNumber}%.%{inventory.%{_player}%.current}%.contents.%{_typeLower}%} to 64
  446. set {_player}'s cursor to {_item}
  447. else:
  448. add item amount of {_item} to {furnace%{inventory.%{_player}%.tierNumber}%.%{inventory.%{_player}%.current}%.contents.%{_typeLower}%}
  449. set {furnace%{inventory.%{_player}%.tierNumber}%.%{inventory.%{_player}%.current}%.contents.%{_typeLower}%Type} to "%type of {_item}%"
  450. set {_item} to air
  451. return {_item}
  452.  
  453. function setItemInSlot(player: Player, type: String, slot: Number, clickedItem: Item, item: Item, startLoop: Boolean, leftClick: Boolean):
  454. if {_type} is not "Ore" or "Fuel" or "Ingot":
  455. stop
  456. set {_typeLower} to {_type} in lower case
  457. if {furnace%{inventory.%{_player}%.tierNumber}%.%{inventory.%{_player}%.current}%.contents.%{_typeLower}%} >= 64:
  458. stop
  459. set {_item} to updateItemInFurnace({_player}, {_item}, {_typeLower}, {_leftClick})
  460. set {_typeString} to " II"
  461. if {inventory.%{_player}%.tierNumber} is 1:
  462. set {_typeString} to " I"
  463.  
  464. set {_player}'s cursor to {_item}
  465. updateItemInSlot({inventory.%{_player}%.current}, {_type}, {_slot}, {_typeString}, {inventory.%{_player}%.tierNumber})
  466. set {furnace%{inventory.%{_player}%.tierNumber}%.%{inventory.%{_player}%.current}%.%{_typeLower}%} to item amount of {_clickedItem}
  467. set {furnace%{inventory.%{_player}%.tierNumber}%.%{inventory.%{_player}%.current}%.%{_typeLower}%Type} to type of {_clickedItem}
  468.  
  469. if {_type} is "Fuel":
  470. set {furnace%{inventory.%{_player}%.tierNumber}%.%{inventory.%{_player}%.current}%.fuelingTimeMax} to getFuelingTime({furnace%{inventory.%{_player}%.tierNumber}%.%{inventory.%{_player}%.current}%.contents.fuelType} parsed as an item) / 20
  471. if {_typeString} is " II":
  472. set {furnace%{inventory.%{_player}%.tierNumber}%.%{inventory.%{_player}%.current}%.fuelingTimeMax} to {furnace%{inventory.%{_player}%.tierNumber}%.%{inventory.%{_player}%.current}%.fuelingTimeMax}*1.05
  473. if {_startLoop}:
  474. if {furnace.%{inventory.%{_player}%.current}%.isAddedToLoop} is not true:
  475. add {inventory.%{_player}%.current} to {furnace1.loopList::*}
  476. set {_id} to size of {furnace1.loopList::*}
  477. set {furnace.idList::%{_id}%} to {_typeString}
  478. set {furnace.idBinds::%{inventory.%{_player}%.current}%} to {_id}
  479. loop_furnace1()
  480.  
  481. function updateItemInSlot(furnaceId: Location, type: String, slot: Number, furnaceTier: String, typeId: integer):
  482. set {_typeLower} to {_type} in lower case
  483. loop {inventoryList.%{_furnaceId}%.furnace%{_furnaceTier}%::*}:
  484. set slot {_slot} of loop-value's current inventory to ("%{furnace%{_typeId}%.%{_furnaceId}%.contents.%{_typeLower}%}% %{furnace%{_typeId}%.%{_furnaceId}%.contents.%{_typeLower}%Type}%" parsed as an item)
  485. if {furnace%{_typeId}%.%{_furnaceId}%.contents.%{_typeLower}%} <= 0:
  486. set slot {_slot} of loop-value's current inventory to lime stained glass pane named "&a&l%{_type}%"
  487.  
  488. function updateItemAndRemoveFromLoop(p: Player, item: Item, slot: Number, furnaceTier: Integer, furnaceTierString: String, itemName: String, leftClick: Boolean):
  489. set {_nameLower} to {_itemName} in lower case
  490. set {_amount} to {furnace%{inventory.%{_p}%.tierNumber}%.%{inventory.%{_p}%.current}%.contents.%{_nameLower}%}
  491. set {_removedAmount} to {_amount}
  492. if {_leftClick} is false:
  493. set {_removedAmount} to getAmountToRemove({_amount}, {_amount} / 2)
  494.  
  495. set {_p}'s cursor slot to ("%{_removedAmount}% %{furnace%{inventory.%{_p}%.tierNumber}%.%{inventory.%{_p}%.current}%.contents.%{_nameLower}%Type}%" parsed as an item)
  496. set {furnace%{inventory.%{_p}%.tierNumber}%.%{inventory.%{_p}%.current}%.contents.%{_nameLower}%} to {_amount}-{_removedAmount}
  497. if {_amount}-{_removedAmount} <= 0:
  498. delete {furnace%{inventory.%{_p}%.tierNumber}%.%{inventory.%{_p}%.current}%.contents.%{_nameLower}%Type}
  499. set slot ({_slot}) of {_p}'s current inventory to lime stained glass pane named "&a&l%{_itemName}%"
  500. if {_nameLower} is "ore" or "fuel":
  501. resetFuelIndicator({inventory.%{_p}%.current}, {_furnaceTierString})
  502. else:
  503. set slot ({_slot}) of {_p}'s current inventory to "%{_amount}-{_removedAmount}% %{furnace%{inventory.%{_p}%.tierNumber}%.%{inventory.%{_p}%.current}%.contents.%{_nameLower}%Type}%" parsed as an item
  504.  
  505. function getAmountToRemove(total: Number, amount: Number) :: Number:
  506. if {_amount} is {_total}:
  507. set {_amount} to 1
  508. add "%({_total}-1) / 2%" parsed as an integer to {_amount}
  509. set {_item} to "%{_total} - {_amount} + 1% %type of {_item}%" parsed as an item
  510. else:
  511. set {_item} to "%{_total} - {_amount}% %type of {_item}%" parsed as an item
  512. return {_amount}
  513.  
  514. function updateInventoryFuelIndicator(furnaceId: Location, progressBar: Integer, furnaceTier: String):
  515. if {_progressBar} <= 4:
  516. if {_progressBar} >= 0:
  517. loop {inventoryList.%{_furnaceId}%.furnace%{_furnaceTier}%::*}:
  518. loop {_progressBar} times:
  519. set slot 19 + loop-value-2 of loop-value-1's current inventory to lime stained glass pane named "&f%20*loop-value-2%%%"
  520. loop 5-{_progressBar} times:
  521. set slot 25-loop-value-2 of loop-value-1's current inventory to dark gray stained glass pane named "&f%100 - 20*((loop-value-2)-1)%%%"
  522.  
  523. function resetFuelIndicator(furnaceId: Location, furnaceTier: String):
  524. set {furnace1.%{_furnaceId}%.smeltTime} to 0
  525. loop {inventoryList.%{_furnaceId}%.furnace%{_furnaceTier}%::*}:
  526. loop 5 times:
  527. set slot 19 + loop-value-2 of loop-value-1's current inventory to gray stained glass pane named "&f%20*loop-value-2%%%"
  528. if {_furnaceTier} is " I":
  529. removeFurnaceFromLoop({_furnaceId})
  530. else:
  531. removeFurnaceFromLoop({_furnaceId})
  532.  
  533. function setIngotType(furnaceId: Location, tier: Number):
  534. if {furnace%{_tier}%.%{_furnaceId}%.contents.ingotType} is set:
  535. stop
  536. set {_type} to "%{furnace%{_tier}%.%{_furnaceId}%.contents.oreType}%"
  537. if {_tier} is 2:
  538. if {_type} is "diamond ore", "emerald ore" or "nether quartz ore":
  539. replace all " ore" in {_type} with " ingot"
  540. {furnace%{_tier}%.%{_furnaceId}%.contents.ingotType}
  541. stop
  542. if "%{_type}%" is "iron ore", "gold ore", "lapis ore" or "redstone ore":
  543. replace "ore" in {_type} with "ingot"
  544. set {furnace%{_tier}%.%{_furnaceId}%.contents.ingotType} to {_type} parsed as an item
  545. else if {_type} is "coal ore":
  546. set {furnace%{_tier}%.%{_furnaceId}%.contents.ingotType} to coal
  547.  
  548. function removeFurnaceFromLoop(furnaceId: Location):
  549. delete {furnace.%{_furnaceId}%.isAddedToLoop}
  550. delete {furnace.idList::%{furnace.idBinds::%{_furnaceId}%}%}
  551. delete {furnace.idBinds::%{_furnaceId}%}
  552. remove {_furnaceId} from {furnace1.loopList::*}
  553. if size of {furnace1.loopList::*} is 0:
  554. set {furnace1.looping} to false
  555.  
  556. function loop_furnace1():
  557. if {furnace1.looping} is not true:
  558. set {furnace1.looping} to true
  559. while {furnace1.looping} is true:
  560. if size of {furnace1.loopList::*} is 0:
  561. set {furnace1.looping} to false
  562. stop loop
  563. else:
  564. set {_current} to 0
  565. loop {furnace1.loopList::*}:
  566. add 1 to {_current}
  567. set {_type} to {furnace.idList::%{_current}%}
  568. set {_tier} to getTierNumber({_type})
  569. if {furnace%{_tier}%.%loop-value%.contents.ore} < 1:
  570. updateInventoryFuelIndicator(loop-value, 0, {_type})
  571. removeFurnaceFromLoop(loop-value)
  572.  
  573. else:
  574. if {furnace%{_tier}%.%loop-value%.fuelingTime} is not set:
  575. remove 1 from {furnace%{_tier}%.%loop-value%.contents.fuel}
  576. set {furnace%{_tier}%.%loop-value%.fuelingTime} to 0
  577. updateItemInSlot(loop-value, "Fuel", 40, {_type}, {_tier})
  578.  
  579. add 1 to {furnace%{_tier}%.%loop-value%.smeltTime}
  580. add 1 to {furnace%{_tier}%.%loop-value%.fuelingTime}
  581. if "%{furnace%{_tier}%.%loop-value%.smeltTime}/2.0%" doesn't contain ".":
  582. if {furnace%{_tier}%.%loop-value%.smeltTime}/2 > 4:
  583. updateInventoryFuelIndicator(loop-value, 0, {_type})
  584. else:
  585. updateInventoryFuelIndicator(loop-value, "%{furnace%{_tier}%.%loop-value%.smeltTime}/2%" parsed as an integer, {_type})
  586. if {furnace%{_tier}%.%loop-value%.smeltTime} > 9:
  587. delete {furnace%{_tier}%.%loop-value%.smeltTime}
  588. remove 1 from {furnace%{_tier}%.%loop-value%.contents.ore}
  589. if {furnace%{_tier}%.%loop-value%.contents.ingot} is not set:
  590. set {furnace%{_tier}%.%loop-value%.contents.ingot} to 0
  591. add 1 to {furnace%{_tier}%.%loop-value%.contents.ingot}
  592. setIngotType(loop-value, {_tier})
  593. updateItemInSlot(loop-value, "Ore", 38, {_type}, {_tier})
  594. updateItemInSlot(loop-value, "Ingot", 42, {_type}, {_tier})
  595. updateInventoryFuelIndicator(loop-value, 0, {_type})
  596.  
  597.  
  598. if {furnace%{_tier}%.%loop-value%.fuelingTime} >= {furnace%{_tier}%.%Loop-value%.fuelingTimeMax}:
  599. if {furnace%{_tier}%.%loop-value%.contents.fuel} <= 0:
  600. delete {furnace%{_tier}%.%loop-value%.smeltTime}
  601. removeFurnaceFromLoop(loop-value)
  602. updateInventoryFuelIndicator(loop-value, 0, {_type})
  603. else:
  604. delete {furnace%{_tier}%.%loop-value%.fuelingTime}
  605. wait 1 second
  606.  
  607.  
  608. #||======================================================||
  609. #|| ________ ________ _ _ _______ _____ ||
  610. #|| | ____\ \ / / ____| \ | |__ __/ ____| ||
  611. #|| | |__ \ \ / /| |__ | \| | | | | (___ ||
  612. #|| | __| \ \/ / | __| | . ` | | | \___ \ ||
  613. #|| | |____ \ / | |____| |\ | | | ____) | ||
  614. #|| |______| \/ |______|_| \_| |_| |_____/ ||
  615. #|| ||
  616. #||======================================================||
  617.  
  618. on rightclick on smooth stone:
  619. if player is not sneaking:
  620. if {anvil.%location of clicked block%} is true:
  621. set {anvil.current.%player%} to 1
  622. openAnvilGui(player)
  623. cancel event
  624.  
  625. on rightclick on iron block:
  626. if player is not sneaking:
  627. if {anvil.%location of clicked block%} is true:
  628. set {anvil.current.%player%} to 2
  629. openAnvilGui(player)
  630. cancel event
  631.  
  632. on rightclick on diamond block:
  633. if player is not sneaking:
  634. if {anvil.%location of clicked block%} is true:
  635. set {anvil.current.%player%} to 3
  636. openAnvilGui(player)
  637. cancel event
  638.  
  639. on rightclick on cauldron:
  640. if {furnace.%location of event-block%} is true:
  641. if isFurnace1(location 1 meters below clicked block):
  642. cancel event
  643. guiFurnace1(player, location of clicked block)
  644.  
  645. else:
  646. delete {furnace1.%location of clicked block%.contents.fuel}
  647. delete {furnace1.%location of clicked block%.contents.ore}
  648. delete {furnace1.%location of clicked block%.contents.ingot}
  649. delete {furnace.%location of event-block%}
  650.  
  651. on rightclick on blast furnace:
  652. if {furnace2.%location of event-block%} is true:
  653. if isFurnace2(location of clicked block):
  654. cancel event
  655. guiFurnace2(player, location of clicked block)
  656. else:
  657. delete {furnace2.%location of event-block%}
  658.  
  659. on rightclick holding any axe:
  660. if clicked block is smooth stone or iron block or diamond block:
  661. if {anvil.%location of event-block%} is not true:
  662. if held item of player is wooden axe:
  663. send "{@logo} You cannot make an anvil using a wooden axe."
  664. stop
  665.  
  666. set {anvil.%location of event-block%} to true
  667. set {_tier} to "Tier I"
  668. if clicked block is smooth stone:
  669. set {anvil.%location of event-block%.tier} to 1
  670. else if clicked block is iron block:
  671. set {anvil.%location of event-block%.tier} to 2
  672. set {_tier} to "Tier II"
  673. else:
  674. set {anvil.%location of event-block%.tier} to 3
  675. set {_tier} to "Tier III"
  676.  
  677. set {_s} to 6
  678. loop all players in radius 6 around event-block:
  679. set {_v} to ({_s} - distance between loop-player and event-block)
  680. play sound "block.anvil.place" with volume {_v} and pitch 0 to loop-player
  681.  
  682. send "{@logo} Successfully created an anvil of %{_tier}%."
  683. summon armor stand at location 0.6 meters below event-block
  684. set name of last spawned armor stand to "&7Anvil"
  685. add "{Invisible:1b,NoGravity:1b,NoAI:1b,CustomNameVisible:1}" to NBT of last spawned armor stand
  686.  
  687. summon armor stand at location 0.9 meters below event-block
  688. set name of last spawned armor stand to "&7%{_tier}%"
  689. add "{Invisible:1b,NoGravity:1b,NoAI:1b,CustomNameVisible:1}" to NBT of last spawned armor stand
  690. show 5 dust of anvil at location 0.0 meters above location of event-block
  691.  
  692.  
  693. else if clicked block is cauldron:
  694. if {furnace.%location of event-block%} is not true:
  695. if held item of player is wooden axe:
  696. send "{@logo} You cannot make a furnace using a wooden axe."
  697. else if isFurnace1(location 1 meters below clicked block):
  698. set {furnace.%location of event-block%} to true
  699. show 5 dust of anvil at location 0.0 meters above location of event-block
  700. cancel event
  701.  
  702. else if clicked block is blast furnace:
  703. if {furnace.%location of event-block%} is not true:
  704. if held item of player is wooden axe:
  705. send "{@logo} You cannot make a furnace using a wooden axe."
  706. else if isFurnace2(location of clicked block):
  707. set {furnace2.%location of event-block%} to true
  708. show 5 dust of anvil at location 0.0 meters above location of event-block
  709. cancel event
  710.  
  711. on break of smooth stone or iron block or diamond block:
  712. if {anvil.%location of event-block%} is true:
  713. set {_s} to 6
  714. loop all players in radius 6 around event-block:
  715. set {_v} to ({_s} - distance between loop-player and event-block)
  716. play sound "block.anvil.place" with volume {_v} and pitch 0 to loop-player
  717. delete {anvil.%location of event-block%}
  718. delete {anvil.%location of event-block%.tier}
  719. loop entities in radius 1 around event-block:
  720. if type of loop-entity is armor stand:
  721. kill loop-entity
  722.  
  723.  
  724. on inventory click:
  725. if type of clicked inventory is chest inventory:
  726. if inventory name of player's current inventory is {@tier1Furnace} or {@tier2Furnace}:
  727. cancel event
  728. if clicked slot is set:
  729. if clicked item is not air:
  730. set {_item} to player's cursor slot
  731. set {_leftClick} to false
  732. if click type is left mouse button:
  733. set {_leftClick} to true
  734. if {_item} is not air:
  735. if name of clicked item is "&a&lOre":
  736. if canSmelt({_item}, 1):
  737. if canSmeltInFurnace(player, {_item}):
  738. setItemInSlot(player, "Ore", clicked slot, clicked item, {_item}, true, {_leftClick})
  739. else if name of clicked item is "&a&lFuel":
  740. if getFuelingTime({_item}) > 0:
  741. setItemInSlot(player, "Fuel", clicked slot, clicked item, {_item}, true, {_leftClick})
  742. else if getFuelingTime(clicked item) > 0:
  743. if getFuelingTime({_item}) > 0:
  744. setItemInSlot(player, "Fuel", clicked slot, clicked item, {_item}, false, {_leftClick})
  745. else if canSmelt(clicked item, 1) is true:
  746. if canSmelt({_item}, 1):
  747. if canSmeltInFurnace(player, {_item}):
  748. setItemInSlot(player, "Ore", clicked slot, clicked item, {_item}, false, {_leftClick})
  749. else if clicked slot is 42:
  750. if type of clicked item is not lime stained glass pane:
  751. updateItemAndRemoveFromLoop(player, clicked item, clicked slot, 1, " %{inventory.%player%.tier}%", "Ingot", {_leftClick})
  752. else if getFuelingTime(clicked item) > 0:
  753. updateItemAndRemoveFromLoop(player, clicked item, clicked slot, 1, " %{inventory.%player%.tier}%", "Fuel", {_leftClick})
  754. else if canSmelt(clicked item, 1) is true:
  755. updateItemAndRemoveFromLoop(player, clicked item, clicked slot, 1, " %{inventory.%player%.tier}%", "Ore", {_leftClick})
  756.  
  757. else if inventory name of player's current inventory starts with "Anvil Tier ":
  758. cancel event
  759. if clicked slot is set:
  760. if clicked item is any helmet, any chestplate, any leggings or any boots:
  761. set {_item::*} to ("%type of clicked item%") split at " "
  762. tryCraftArmour(player, {_item::1}, {_item::2})
  763. else:
  764. loop {blacksmith.anvilGui.materialOrder::*}:
  765. if {blacksmith.anvilGui.materialNameList::%loop-index%} is set:
  766. if clicked item is {blacksmith.anvilGui.materialOrder::%loop-index%} named {blacksmith.anvilGui.materialNameList::%loop-index%}:
  767. openAnvilCraftGui(player, loop-index parsed as an integer)
  768.  
  769.  
  770. else if inventory name of player's current inventory is "Smithing":
  771. cancel event
  772. if clicked slot is set:
  773. if {blacksmith.smithing.%player%.chainmail} is true:
  774. if clicked item is iron nugget named "&fCreate Rings" without any NBT:
  775. if {blacksmith.smithing.%player%.stage} is 0:
  776. add 1 to {blacksmith.smithing.%player%.stage}
  777. set slot 22 of player's current inventory to iron hoe named "&a&lJoin Rings" with lore "&7", "&7Click the corresponding item" and "&7to continue crafting." without any NBT
  778. play sound "entity.item.pickup" with volume 12 and pitch 2 to player
  779. else:
  780. userFailedMinigame(player)
  781.  
  782. else if clicked item is iron hoe named "&fJoin Rings" without any NBT:
  783. if {blacksmith.smithing.%player%.stage} is 1:
  784. add 1 to {blacksmith.smithing.%player%.stage}
  785. play sound "block.anvil.land" with volume 10 and pitch 1 to player
  786. setSmithingGui(player)
  787. else:
  788. userFailedMinigame(player)
  789. else:
  790. if clicked item is iron pressure plate named "&fDraw" without any NBT:
  791. if {blacksmith.smithing.%player%.stage} is 0:
  792. play sound "block.anvil.use" with volume 12 and pitch 1 to player
  793. if {blacksmith.smithing.%player%.stage} is 0:
  794. set slot 22 of player's current inventory to iron ingot named "&a&lBend" with lore "&7", "&7Click the corresponding item" and "&7to continue crafting." without any NBT
  795. add 1 to {blacksmith.smithing.%player%.stage}
  796. else:
  797. userFailedMinigame(player)
  798. else if clicked item is iron ingot named "&fBend" without any NBT:
  799. if {blacksmith.smithing.%player%.stage} is 1 or 3:
  800. play sound "block.anvil.use" with volume 12 and pitch 2 to player
  801. if {blacksmith.smithing.%player%.stage} is 1:
  802. set slot 22 of player's current inventory to iron axe named "&a&lHammer" with lore "&7", "&7Click the corresponding item" and "&7to continue crafting." without any NBT
  803. else:
  804. set slot 22 of player's current inventory to water bucket named "&a&lCool" with lore "&7", "&7Click the corresponding item" and "&7to continue crafting."
  805. add 1 to {blacksmith.smithing.%player%.stage}
  806. else:
  807. userFailedMinigame(player)
  808.  
  809.  
  810. else if clicked item is iron axe named "&fHammer" without any NBT:
  811. if {blacksmith.smithing.%player%.stage} is 2:
  812. add 1 to {blacksmith.smithing.%player%.stage}
  813. play sound "block.anvil.use" with volume 12 and pitch 2 to player
  814. set slot 22 of player's current inventory to iron ingot named "&a&lBend" with lore "&7", "&7Click the corresponding item" and "&7to continue crafting."
  815. else:
  816. userFailedMinigame(player)
  817. else if clicked item is water bucket named "&fCool" without any NBT:
  818. if {blacksmith.smithing.%player%.stage} is 4:
  819. play sound "block.anvil.land" with volume 12 and pitch 2 to player
  820. give {blacksmith.smithing.%player%.result} to player
  821. close player's inventory
  822. else:
  823. userFailedMinigame(player)
  824.  
  825. on inventory close:
  826. if {inventory.%player%.name} is set:
  827. remove player from {inventoryList.%{inventory.%player%.current}%.%{inventory.%player%.name}%::*}
  828. delete {inventory.%player%.name}
  829. delete {inventory.%player%.current}
  830. else if {anvil.current.%player%} is set:
  831. delete {anvil.current.%player%}
  832.  
  833. on inventory drag:
  834. set {_tier1} to uncolored {@tier1Furnace}
  835. if {inventory.%player%.name} is "Anvil" or "%{_tier1}%" or "Furnace II":
  836. cancel event
  837. else if {anvil.current.%player%} is set:
  838. cancel event
  839.  
  840. on craft:
  841. if event-item is any helmet, any chestplate, any leggings, any boots, any sword, any pickaxe, any axe, any shovel or any hoe:
  842. set {_item::*} to ("%event-item%") split at " "
  843. # Unoptimized code due to issues using '{_item::1} is not "leather", "wood" and "stone":'
  844. if {_item::1} is not "leather":
  845. if {_item::1} is not "wood":
  846. if {_item::1} is not "stone":
  847. send "{@logo} You cannot craft this item in a crafting table!"
  848. cancel event
  849.  
  850. on right click on armor stand:
  851. if name of event-entity contains "Anvil" or "Tier I":
  852. cancel event
  853.  
  854.  
Add Comment
Please, Sign In to add comment