Zeldaboy111

Armor functie ]|[ Skript #394

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