Zeldaboy111

Blacksmith af! ]|[ Skript #397

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