Zeldaboy111

Minigame aanpassen ]|[ Skript #396

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