Zeldaboy111

Right Click ]|[ Skript #359

Oct 29th, 2020 (edited)
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.15 KB | None | 0 0
  1. #multiblock structure
  2. #rename function
  3.  
  4. #requires: SkQuery, SkRayFall, Skellett, SkBee, TuSKe
  5.  
  6.  
  7. options:
  8. logo: &6&lBS&8:&7
  9. tier1Furnace: "&8Furnace I"
  10.  
  11. function updateItemInSlot(furnaceId: Location, type: String, slot: Number, furnaceTier: String, typeId: integer):
  12. set {_typeLower} to {_type} in lower case
  13. loop {inventoryList.%{_furnaceId}%.furnace%{_furnaceTier}%::*}:
  14. 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)
  15. if {furnace%{_typeId}%.%{_furnaceId}%.contents.%{_typeLower}%} <= 0:
  16. set slot {_slot} of loop-value's current inventory to lime stained glass pane named "&a&l%{_type}%"
  17.  
  18. function updateItemAndRemoveFromLoop(p: Player, item: Item, slot: Number, furnaceTier: Integer, furnaceTierString: String, itemName: String, leftClick: Boolean):
  19. set {_nameLower} to {_itemName} in lower case
  20. set {_amount} to {furnace1.%{inventory.%{_p}%.current}%.contents.%{_nameLower}%}
  21. set {_removedAmount} to {_amount}
  22. if {_leftClick} is false:
  23. set {_removedAmount} to "%{_amount}/2%" parsed as a integer
  24. set {_item} to "%{_amount}-{_removedAmount}% %type of {_item}%" parsed as an item
  25.  
  26. set {_p}'s cursor slot to {_item}
  27. set {furnace1.%{inventory.%{_p}%.current}%.contents.%{_nameLower}%} to {_amount}-{_removedAmount}
  28. if {_amount}-{_removedAmount} <= 0:
  29. delete {furnace1.%{inventory.%{_p}%.current}%.contents.%{_nameLower}%Type}
  30. set slot ({_slot}) of {_p}'s current inventory to lime stained glass pane named "&a&l%{_itemName}%"
  31. if {_nameLower} is "ore" or "fuel":
  32. resetFuelIndicator({inventory.%{_p}%.current}, {_furnaceTierString})
  33. else:
  34. set slot ({_slot}) of {_p}'s current inventory to "%{_amount}-{_removedAmount}% %{furnace1.%{inventory.%{_p}%.current}%.contents.%{_nameLower}%Type}%" parsed as an item
  35. #ingots update werkt niet
  36. #klik op slot met item terwijl er een item in het slot zit -> maak er een hele stack van indien het kan
  37.  
  38.  
  39. function updateInventoryFuelIndicator(furnaceId: Location, progressBar: Integer, furnaceTier: String):
  40. if {_progressBar} <= 4:
  41. if {_progressBar} >= 0:
  42. loop {inventoryList.%{_furnaceId}%.furnace%{_furnaceTier}%::*}:
  43. set slot 20+{_progressBar} of loop-value's current inventory to gray stained glass pane named "&f%20*({_progressBar}+1)%%%"
  44. if {_progressBar} > 0:
  45. set slot 20+{_progressBar}-1 of loop-value's current inventory to lime stained glass pane named "&f%20*{_progressBar}%%%"
  46. loop 4-{_progressBar} times:
  47. 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)%%%"
  48.  
  49. function resetFuelIndicator(furnaceId: Location, furnaceTier: String):
  50. set {furnace1.%{_furnaceId}%.smeltTime} to 0
  51. loop {inventoryList.%{_furnaceId}%.furnace%{_furnaceTier}%::*}:
  52. loop 5 times:
  53. set slot 19 + loop-value-2 of loop-value-1's current inventory to gray stained glass pane named "&f%20*loop-value-2%%%"
  54. if {_furnaceTier} is " I":
  55. removeFurnaceFromLoop({_furnaceId}, 1)
  56. else:
  57. removeFurnaceFromLoop({_furnaceId}, 2)
  58.  
  59. function setIngotType(furnaceId: Location, tier: Number):
  60. delete {furnace%{_tier}%.%{_furnaceId}%.contents.ingotType}
  61. if {furnace%{_tier}%.%{_furnaceId}%.contents.ingotType} is set:
  62. stop
  63. set {_type} to "%{furnace%{_tier}%.%{_furnaceId}%.contents.oreType}%"
  64. if {_tier} is 2:
  65. if {_type} is "diamond ore", "emerald ore" or "nether quartz ore":
  66. replace all " ore" in {_type} with ""
  67. set {furnace2.%{_furnaceId}%.contents.ingotType} to {_type} parsed as an item
  68. stop
  69. if {_type} is "iron ore", "gold ore", "lapis ore" and "redstone ore":
  70. replace "ore" in {_type} with "ingot"
  71. set {furnace%{_tier}%.%{_furnaceId}%.contents.ingotType} to {_type} parsed as an item
  72. else if {_type} is "coal ore":
  73. set {furnace%{_tier}%.%{_furnaceId}%.contents.ingotType} to coal
  74.  
  75. function removeFurnaceFromLoop(furnaceId: Location, typeId: integer):
  76. delete {furnace.%{_furnaceId}%.isAddedToLoop}
  77. remove {_furnaceId} from {furnace%{_typeId}%.loopList::*}
  78.  
  79.  
  80. function loop_furnace1():
  81. set {furnace1.looping} to false
  82. if {furnace1.looping} is not true:
  83. set {furnace1.looping} to true
  84. while {furnace1.looping} is true:
  85. if size of {furnace1.loopList::*} is 0:
  86. set {furnace1.looping} to false
  87. stop loop
  88. else:
  89. loop {furnace1.loopList::*}:
  90. if {furnace1.%loop-value%.contents.ore} < 1:
  91. updateInventoryFuelIndicator(loop-value, 0, " I")
  92. removeFurnaceFromLoop(loop-value, 1)
  93.  
  94. else:
  95. if {furnace1.%loop-value%.contents.fuelingTime} is not set:
  96. remove 1 from {furnace1.%loop-value%.contents.fuel}
  97. updateItemInSlot(loop-value, "Fuel", 40, " I", 1)
  98.  
  99. add 1 to {furnace1.%loop-value%.smeltTime}
  100. add 1 to {furnace1.%loop-value%.fuelingTime}
  101. if "%{furnace1.%loop-value%.smeltTime}/2.0%" doesn't contain ".":
  102. if {furnace1.%loop-value%.smeltTime}/2 > 4:
  103. updateInventoryFuelIndicator(loop-value, 0, " I")
  104. else:
  105. updateInventoryFuelIndicator(loop-value, "%{furnace1.%loop-value%.smeltTime}/2%" parsed as an integer, " I")
  106. if {furnace1.%loop-value%.smeltTime} > 9:
  107. delete {furnace1.%loop-value%.smeltTime}
  108. remove 1 from {furnace1.%loop-value%.contents.ore}
  109. add 1 to {furnace1.%loop-value%.contents.ingot}
  110. setIngotType(loop-value, 1)
  111. updateItemInSlot(loop-value, "Ore", 38, " I", 1)
  112. updateItemInSlot(loop-value, "Ingot", 42, " I", 1)
  113. updateInventoryFuelIndicator(loop-value, 0, " I")
  114.  
  115.  
  116. if {furnace1.%loop-value%.fuelingTime} >= {furnace1.%Loop-value%.fuelingTimeMax}:
  117. if {furnace1.%loop-value%.contents.fuel} <= 0:
  118. delete {furnace1.%loop-value%.smeltTime}
  119. removeFurnaceFromLoop(loop-value, 1)
  120. updateInventoryFuelIndicator(loop-value, 0, " I")
  121. else:
  122. delete {furnace1.%loop-value%.fuelingTime}
  123. wait 1 second
  124.  
  125. #function loop_furnace2():
  126. #if {furnace2.looping} is not true
  127.  
  128. # Returns how many ticks an item gives fuel
  129. function getFuelingTime(type: Item) :: integer:
  130. if {_type} is lava:
  131. return 20000
  132. else if {_type} is block of coal:
  133. return 16000
  134. else if {_type} is dried kelp block:
  135. return 4000
  136. else if {_type} is blaze rod:
  137. return 2400
  138. else if {_type} is coal or charcoal:
  139. return 1600
  140. else if {_type} is any boat or scaffolding:
  141. return 1200
  142. else if {_type} is any log or any planks or any wood slab or oak wood stairs or spruce wood stairs or birch wood stairs or jungle wood stairs or acacia wood stairs or dark oak wood stairs or any wooden button or any wooden trapdoor or any fence gate or any fence or ladder or crafting table or cartography table or fletching table or smithing table or loom or bookshelf or lectern or composter or chest or trapped chest or barrel or daylight detector or jukebox or note block or red mushroom block or brown mushroom block or mushroom stem or banner or bow or fishing rod:
  143. return 300
  144. else if {_type} is any wooden door or any sign or wooden pickaxe or wooden shovel or wooden hoe or wooden axe or wooden sword:
  145. return 200
  146. else if {_type} is bowl or any sapling or stick or any wool:
  147. return 100
  148. else if {_type} is any carpet:
  149. return 67
  150. else if {_type} is bamboo:
  151. return 50
  152. return 0
  153.  
  154. # Returns if the item can be smelted in the furnace, every smelt takes 10 seconds in a normal furnace
  155. function canSmelt(type: Item, tier: Integer) :: boolean:
  156. if {_type} is iron ore or gold ore or lapis ore or redstone ore or coal ore:
  157. return true
  158. else if {_tier} is 2:
  159. if {_type} is diamond ore or emerald ore or nether quartz ore:
  160. return true
  161.  
  162. return false
  163.  
  164. function canSmeltInFurnace(p: Player, item: Item) :: boolean:
  165. set {_furnaceId} to {inventory.%{_p}%.current}
  166. if {furnace1.%{_furnaceId}%.contents.oreType} is set:
  167. if "%type of {_item}%" is not "%type of {furnace1.%{_furnaceId}%.contents.oreType}%":
  168. return false
  169.  
  170. if {furnace1.%{_furnaceId}%.contents.ingotType} is set:
  171. if type of {_item} is coal ore:
  172. if type of {furnace1.%{_furnaceId}%.contents.ingotType} is coal:
  173. return true
  174. set {_item} to "%type of {_item}%"
  175. replace all " ore" in {_item} with " ingot"
  176. if {_item} is not "%type of {furnace1.%{_furnaceId}%.contents.ingotType}%":
  177. return false
  178. return true
  179.  
  180.  
  181. function outlineGui(p: Player):
  182. loop 9 times:
  183. set slot loop-value - 1 of {_p}'s current inventory to gray stained glass pane named "&8"
  184. set slot 54-loop-value of {_p}'s current inventory to gray stained glass pane named "&8"
  185.  
  186. loop 5 times:
  187. set slot loop-value * 9 of {_p}'s current inventory to gray stained glass pane named "&8"
  188. set slot loop-value * 9-1 of {_p}'s current inventory to gray stained glass pane named "&8"
  189.  
  190. function openGuiOutlined(p: Player, loc: Location, rows: integer, name: String):
  191. open chest with {_rows} rows named {_name} to {_p}
  192. set {inventory.%{_p}%.name} to uncolored {_name}
  193. set {inventory.%{_p}%.current} to {_loc}
  194. add {_p} to {inventoryList.%{_loc}%.%{inventory.%{_p}%.name}%::*}
  195. wait 2 ticks
  196. outlineGui({_p})
  197.  
  198. function guiFurnace1(p: Player, loc: Location):
  199. openGuiOutlined({_p}, {_loc}, 6, {@tier1Furnace})
  200.  
  201. if {furnace1.%{_loc}%.contents.fuel} is not set:
  202. set {furnace1.%{_loc}%.contents.fuel} to 0
  203. if {furnace1.%{_loc}%.contents.ore} is not set:
  204. set {furnace1.%{_loc}%.contents.ore} to 0
  205. if {furnace1.%{_loc}%.contents.ingot} is not set:
  206. set {furnace1.%{_loc}%.contents.ingot} to 0
  207.  
  208. if {furnace1.%{_loc}%.contents.ingotType} is not set:
  209. set {furnace1.%{_loc}%.contents.ingot} to 0
  210. if {furnace1.%{_loc}%.contents.oreType} is not set:
  211. set {furnace1.%{_loc}%.contents.ore} to 0
  212. if {furnace1.%{_loc}%.contents.fuelType} is not set:
  213. set {furnace1.%{_loc}%.contents.fuel} to 0
  214.  
  215. set {furnace1.%{_loc}%.fuelingTimeMax} to 0
  216. if {furnace1.%{_loc}%.contents.fuelType} is set:
  217. set {furnace1.%{_loc}%.fuelingTimeMax} to getFuelingTime({furnace1.%{_loc}%.contents.fuelType}) / 20
  218.  
  219. set slot 38 of {_p}'s current inventory to lime stained glass pane named "&a&lOre"
  220. set slot 40 of {_p}'s current inventory to lime stained glass pane named "&a&lFuel"
  221. set slot 42 of {_p}'s current inventory to lime stained glass pane named "&a&lIngot"
  222.  
  223. if {furnace1.%{_loc}%.contents.ore} > 0:
  224. set slot 38 of {_p}'s current inventory to ("%{furnace1.%{_loc}%.contents.ore}% %{furnace1.%{_loc}%.contents.oreType}%" parsed as an item)
  225.  
  226. if {furnace1.%{_loc}%.contents.fuel} > 0:
  227. set slot 40 of {_p}'s current inventory to ("%{furnace1.%{_loc}%.contents.fuel}% %{furnace1.%{_loc}%.contents.fuelType}%" parsed as an item)
  228.  
  229. if {furnace1.%{_loc}%.contents.ingot} > 0:
  230. set slot 42 of {_p}'s current inventory to ("%{furnace1.%{_loc}%.contents.ingot}% %{furnace1.%{_loc}%.contents.ingotType}%" parsed as an item)
  231.  
  232. loop 5 times:
  233. set slot 19 + loop-value of {_p}'s current inventory to gray stained glass pane named "&f%20*loop-value%%%"
  234.  
  235. set {_progressBar} to "%{furnace1.%{_loc}%.smeltTime}/2.0%"
  236. if {_progressBar} contains ".":
  237. set {_progressBar::*} to {_progressBar} split at "."
  238. set {_progressBar} to {_progressBar::1}
  239.  
  240. loop ({_progressBar} parsed as an integer) times:
  241. set slot 20+loop-value -1 of {_p}'s current inventory to lime stained glass pane named "&f%20*loop-value%%%"
  242.  
  243. # U T I L I T I E S
  244.  
  245. function getNextNumber(base: number, addToDefault: number, max: number) :: number:
  246. set {_value} to {_base} + {_addToDefault}
  247. if {_value} > {_max}:
  248. set {_value} to {_addToDefault} - ({_max} - {_base})
  249.  
  250. return {_value}
  251.  
  252. function detectStair(facing: number, loc: Location, startValue: String) :: boolean:
  253. set {_list::*} to "westward red brick stair", "red brick stair", "eastward red brick stair" and "southward red brick stair"
  254. set {_dir} to {_facing}/2 + 1
  255.  
  256. if {_dir} > 4:
  257. remove 4 from {_dir}
  258.  
  259. if "%block at location of {_loc}%" is "%{_startValue}%%{_list::%{_dir}%}%":
  260. return true
  261. return false
  262.  
  263. function setItemInSlot(p: Player, type: String, slot: number, clickedItem: Item, item: Item, startLoop: Boolean, leftClick: Boolean):
  264. if {_type} is "Ore" or "Fuel" or "Ingot":
  265. set {_typeLower} to {_type} in lower case
  266. if {_leftClick} is false:
  267. if {furnace1.%{inventory.%{_p}%.current}%.contents.%{_typeLower}%} >= 64:
  268. stop
  269. add 1 to {furnace1.%{inventory.%{_p}%.current}%.contents.%{_typeLower}%}
  270. set {furnace1.%{inventory.%{_p}%.current}%.contents.%{_typeLower}%Type} to type of {_item}
  271. #set item amount of {_item} to item amount of {_item}-1
  272. remove 1 from item amount of {_item}
  273. #set item amount of {_p}'s cursor to item amount of {_item}-1
  274. set {_p}'s cursor to {_item}
  275. #set slot {_slot} of {_p}'s current inventory to {_item}
  276. #else:
  277.  
  278. set {_typeId} to 2
  279. set {_typeString} to " II"
  280. if {inventory.%{_p}%.name} is {@tier1Furnace}:
  281. set {_typeId} to 1
  282. set {_typeString} to " I"
  283. updateItemInSlot({inventory.%{_p}%.current}, {_type}, {_slot}, {_typeString}, {_typeId})
  284. #set {_p}'s cursor slot to {_clickedItem}
  285. #set slot {_slot} of {_p}'s current inventory to {_item}
  286. #set {_itemStack::*} to ("%{_item}%") split at " "
  287. #if ({_itemStack::1} parsed as a number) is not set:
  288. # set {_itemStack::3} to {_itemStack::2}
  289. # set {_itemStack::2} to {_itemStack::1}
  290. # set {_itemStack::1} to "1"
  291. #set {furnace1.%{inventory.%{_p}%.current}%.contents.%{_type}%} to {_itemStack::1} parsed as a number
  292. #set {furnace1.%{inventory.%{_p}%.current}%.contents.%{_type}%Type} to type of {_item}
  293.  
  294. if {_startLoop}:
  295. if {furnace.%{inventory.%{_p}%.current}%.isAddedToLoop} is not true:
  296. add {inventory.%{_p}%.current} to {furnace1.loopList::*}
  297. loop_furnace1()
  298. # ingots
  299.  
  300.  
  301. # F U R N A C E D E T E C T S
  302.  
  303. function isFurnace1(below: Location) :: boolean:
  304. if block at {_below} is campfire:
  305. set {_xAdjust::*} to 1, 1, 1, 0, 0, -1, -1 and -1
  306. set {_zAdjust::*} to 1, 0, -1, 1, -1, 1, 0 and -1
  307. loop 8 times:
  308. 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}
  309. if block at {_checkLoc} is not red brick block:
  310. return false
  311. else:
  312. return false
  313. return true
  314.  
  315.  
  316. function isFurnace2(loc: Location) :: boolean:
  317. if block at {_loc} is not blast furnace:
  318. return false
  319.  
  320. set {_layer1::*} to air, brick slab, red brick block, air, red brick block, air, red brick block and brick slab
  321. set {_layer2::*} to air, red brick stair, eastward red brick stair and southward red brick stair
  322. set {_x::*} to 1, 1, 0, -1, -1, -1, 0 and 1
  323. set {_z::*} to 0, 1, 1, 1, 0, -1, -1 and -1
  324.  
  325. set {_base} to -2
  326. if block at location at x-coordinate of {_loc} + {_x::1}, y-coordinate of {_loc}, z-coordinate of {_loc} + {_z::1} in world of {_loc} is {_layer1::1}:
  327. set {_base} to 0
  328.  
  329. else if block at location at x-coordinate of {_loc} + {_x::3}, y-coordinate of {_loc}, z-coordinate of {_loc} + {_z::3} in world of {_loc} is {_layer1::1}:
  330. set {_base} to 2
  331.  
  332. else if block at location at x-coordinate of {_loc} + {_x::5}, y-coordinate of {_loc}, z-coordinate of {_loc} + {_z::5} in world of {_loc} is {_layer1::1}:
  333. set {_base} to 4
  334.  
  335. else if block at location at x-coordinate of {_loc} + {_x::7}, y-coordinate of {_loc}, z-coordinate of {_loc} + {_z::7} in world of {_loc} is {_layer1::1}:
  336. set {_base} to 6
  337.  
  338. set {_size} to size of {_x::*}
  339. if {_base} is not -2:
  340. loop 7 times:
  341. set {_value} to getNextNumber({_base}, loop-value, {_size})
  342. if block at location at x-coordinate of {_loc} + {_x::%{_value}%}, y-coordinate of {_loc}, z-coordinate of {_loc} + {_z::%{_value}%} in world of {_loc} is not {_layer1::%loop-value%}:
  343. return false
  344.  
  345.  
  346. set {_facingAdjust::*} to 0, 4, 6 and 8
  347. if detectStair({_base}, location 1 meters above {_loc}, "top "):
  348. loop 4 times:
  349. set {_value} to getNextNumber({_base}, loop-value*2, {_size}) - 1
  350. 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}
  351. set {_facing} to {_base}
  352. if {_facing} - {_facingAdjust::%loop-value%} >= 2:
  353. remove {_facingAdjust::%loop-value%} from {_facing}
  354. else:
  355. add {_facingAdjust::%loop-value%} to {_facing}
  356.  
  357. if loop-value is 1:
  358. if block at {_check} is not {_layer2::%loop-value%}:
  359. return false
  360. else if detectStair({_facing} - 2, {_check}, "") is false:
  361. return false
  362.  
  363. if block at location 2 meters above {_loc} is not red brick block:
  364. return false
  365. else:
  366. return false
  367. else:
  368. return false
  369. return true
  370.  
  371. # C L I C K E V E N T S
  372.  
  373. on rightclick on smooth stone:
  374. if player is not sneaking:
  375. if {anvil.%location of clicked block%} is true:
  376. #gui(player)
  377. cancel event
  378.  
  379. on rightclick on cauldron:
  380. if {furnace.%location of event-block%} is true:
  381. if isFurnace1(location 1 meters below clicked block):
  382. cancel event
  383. guiFurnace1(player, location of clicked block)
  384.  
  385. else:
  386. delete {furnace1.%location of clicked block%.contents.fuel}
  387. delete {furnace1.%location of clicked block%.contents.ore}
  388. delete {furnace1.%location of clicked block%.contents.ingot}
  389. delete {furnace.%location of event-block%}
  390.  
  391. on rightclick on blast furnace:
  392. if {furnace2.%location of event-block%} is true:
  393. if isFurnace2(location of clicked block):
  394. cancel event
  395. send "WIP"
  396. else:
  397. delete {furnace2.%location of event-block%}
  398.  
  399. on rightclick holding stone axe:
  400. if clicked block is smooth stone or iron block or diamond block:
  401. if {anvil.%location of event-block%} is not true:
  402. set {anvil.%location of event-block%} to true
  403. set {_tier} to "Tier I"
  404. if clicked block is smooth stone:
  405. set {anvil.%location of event-block%.tier} to 1
  406. else if clicked block is iron block:
  407. set {anvil.%location of event-block%.tier} to 2
  408. set {_tier} to "Tier II"
  409. else:
  410. set {anvil.%location of event-block%.tier} to 3
  411. set {_tier} to "Tier III"
  412.  
  413. set {_s} to 6
  414. loop all players in radius 6 around event-block:
  415. set {_v} to ({_s} - distance between loop-player and event-block)
  416. play sound "block.anvil.place" with volume {_v} and pitch 0 to loop-player
  417.  
  418. send "{@logo} Successfully created an anvil of %{_tier}%."
  419. summon armor stand at location 0.6 meters below event-block
  420. set name of last spawned armor stand to "&7Anvil"
  421. add "{Invisible:1b,NoGravity:1b,NoAI:1b,CustomNameVisible:1}" to NBT of last spawned armor stand
  422.  
  423. summon armor stand at location 0.9 meters below event-block
  424. set name of last spawned armor stand to "&7%{_tier}%"
  425. add "{Invisible:1b,NoGravity:1b,NoAI:1b,CustomNameVisible:1}" to NBT of last spawned armor stand
  426.  
  427. else if clicked block is cauldron:
  428. if {furnace.%location of event-block%} is not true:
  429. if isFurnace1(location 1 meters below clicked block):
  430. set {furnace.%location of event-block%} to true
  431. cancel event
  432.  
  433. else if clicked block is blast furnace:
  434. if {furnace.%location of event-block%} is not true:
  435. if isFurnace2(location of clicked block):
  436. set {furnace2.%location of event-block%} to true
  437. cancel event
  438. send "WIP"
  439.  
  440. on break of smooth stone or iron block or diamond block:
  441. if {anvil.%location of event-block%} is true:
  442. set {_s} to 6
  443. loop all players in radius 6 around event-block:
  444. set {_v} to ({_s} - distance between loop-player and event-block)
  445. play sound "block.anvil.place" with volume {_v} and pitch 0 to loop-player
  446. delete {anvil.%location of event-block%}
  447. delete {anvil.%location of event-block%.tier}
  448. loop entities in radius 1 around event-block:
  449. if type of loop-entity is armor stand:
  450. kill loop-entity
  451.  
  452.  
  453. #right and left click fixes?
  454. on inventory click:
  455. if type of clicked inventory is chest inventory:
  456. if inventory name of player's current inventory is "&8Anvil":
  457. cancel event
  458.  
  459. else if inventory name of player's current inventory is {@tier1Furnace}:
  460. #if click type is left mouse button:
  461. # send "LEft"
  462. cancel event
  463. if clicked slot is set:
  464. if clicked item is not air:
  465. set {_item} to player's cursor slot
  466. set {_leftClick} to false
  467. if click type is left mouse button:
  468. set {_leftClick} to true
  469. if {_item} is not air:
  470. if name of clicked item is "&a&lOre":
  471. if canSmelt({_item}, 1):
  472. if canSmeltInFurnace(player, {_item}):
  473. setItemInSlot(player, "Ore", clicked slot, clicked item, {_item}, true, {_leftClick})
  474. else if name of clicked item is "&a&lFuel":
  475. if getFuelingTime({_item}) > 0:
  476. setItemInSlot(player, "Fuel", clicked slot, clicked item, {_item}, true, {_leftClick})
  477. else if getFuelingTime(clicked item) > 0:
  478. if getFuelingTime({_item}) > 0:
  479. setItemInSlot(player, "Fuel", clicked slot, clicked item, {_item}, false, {_leftClick})
  480. else if canSmelt(clicked item, 1) is true:
  481. if canSmelt({_item}, 1):
  482. if canSmeltInFurnace(player, {_item}):
  483. setItemInSlot(player, "Ore", clicked slot, clicked item, {_item}, false, {_leftClick})
  484. else if clicked slot is 42:
  485. if type of clicked item is not lime stained glass pane:
  486. updateItemAndRemoveFromLoop(player, clicked item, clicked slot, 1, " I", "Ingot", {_leftClick})
  487. else if getFuelingTime(clicked item) > 0:
  488. updateItemAndRemoveFromLoop(player, clicked item, clicked slot, 1, " I", "Fuel", {_leftClick})
  489. else if canSmelt(clicked item, 1) is true:
  490. updateItemAndRemoveFromLoop(player, clicked item, clicked slot, 1, " I", "Ore", {_leftClick})
  491.  
  492. on inventory close:
  493. if {inventory.%player%.name} is set:
  494. remove player from {inventoryList.%{inventory.%player%.current}%.%{inventory.%player%.name}%::*}
  495. delete {inventory.%player%.name}
  496. delete {inventory.%player%.current}
  497.  
  498. on inventory drag:
  499. if {inventory.%player%.name} is "Anvil" or {@tier1Furnace} or "Furnace II":
  500. cancel event
  501.  
  502.  
  503. on disable:
  504. if {furnace1.looping} is true:
  505. set {furnace1.looping} to false
  506. set {furnace1.loopStopped} to true
  507.  
  508. on enable:
  509. wait 1 second
  510. if {furnace1.loopStopped} is true:
  511. set {furnace1.looping} to true
  512. set {furnace1.loopStopped} to false
  513. #Cancel in crafting table or below
  514. #register new shaped recipe for air using iron ingot, air, iron ingot, iron ingot, chest, iron ingot, air, iron ingot, air
  515.  
Add Comment
Please, Sign In to add comment