Zeldaboy111

Smeltery detecten ]|[ Skript #334

Aug 2nd, 2020
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.20 KB | None | 0 0
  1. #multiblock structure
  2. #rename function
  3.  
  4. #requires: SkQuery, SkRayFall, Skellett, SkBee
  5.  
  6.  
  7. options:
  8. logo: &6&lBS&8:&7
  9.  
  10. function gui(p: Player):
  11. open chest with 6 rows named "&8Anvil" to {_p}
  12. wait 2 ticks
  13. loop 9 times:
  14. set slot loop-value - 1 of {_p}'s current inventory to gray stained glass pane named "&8"
  15. set slot 54-loop-value of {_p}'s current inventory to gray stained glass pane named "&8"
  16.  
  17. loop 5 times:
  18. set slot loop-value * 9 of {_p}'s current inventory to gray stained glass pane named "&8"
  19. set slot loop-value * 9-1 of {_p}'s current inventory to gray stained glass pane named "&8"
  20.  
  21. function isFurnace1(below: Location) :: boolean:
  22. if block at {_below} is campfire:
  23. set {_xAdjust::*} to 1, 1, 1, 0, 0, -1, -1 and -1
  24. set {_zAdjust::*} to 1, 0, -1, 1, -1, 1, 0 and -1
  25. loop 8 times:
  26. 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}
  27. if block at {_checkLoc} is not red brick block:
  28. return false
  29. else:
  30. return false
  31. return true
  32.  
  33. function isFurnace2(loc: Location) :: boolean:
  34.  
  35. if block at {_loc} is not blast furnace:
  36. return false
  37.  
  38. set {_layer1::*} to air, brick slab, red brick block, air, red brick block, air, red brick block and brick slab
  39. set {_layer2::*} to air, red brick stair, eastward red brick stair and southward red brick stair
  40. set {_x::*} to 1, 1, 0, -1, -1, -1, 0 and 1
  41. set {_z::*} to 0, 1, 1, 1, 0, -1, -1 and -1
  42. #Facing East
  43. 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}:
  44. loop 7 times:
  45. if block at location at x-coordinate of {_loc} + {_x::%loop-value%}, y-coordinate of {_loc}, z-coordinate of {_loc} + {_z::%loop-value%} in world of {_loc} is not {_layer1::%loop-value%}:
  46. return false
  47.  
  48. if block at location 1 meters above {_loc} is top westward red brick stair:
  49. loop 4 times:
  50.  
  51. if block at location at x-coordinate of {_loc} + {_x::%loop-value + {_adjust}%}, y-coordinate of {_loc}, z-coordinate of {_loc} + {_z::%loop-value + {_adjust}%} in world of {_loc} is not {_layer1::%loop-value%}:
  52. return false
  53. add 2 to {_adjust}
  54.  
  55. broadcast "DETECTED FURNACE"
  56. else:
  57. return false
  58. else:
  59. return false
  60. return true
  61.  
  62.  
  63. on rightclick on smooth stone:
  64. if player is not sneaking:
  65. if {anvil.%location of clicked block%} is true:
  66. gui(player)
  67. cancel event
  68.  
  69. on rightclick on cauldron:
  70. if {furnace.%location of event-block%} is true:
  71. if isFurnace1(location 1 meters below clicked block):
  72. cancel event
  73. send "WIP"
  74. else:
  75. delete {furnace.%location of event-block%}
  76.  
  77. on rightclick on blast furnace:
  78. if {furnace2.%location of event-block%} is true:
  79. if isFurnace2(location of clicked block):
  80. cancel event
  81. send "WIP"
  82. else:
  83. delete {furnace2.%location of event-block%}
  84.  
  85. on rightclick holding stone axe:
  86. if clicked block is smooth stone or iron block or diamond block:
  87. if {anvil.%location of event-block%} is not true:
  88. set {anvil.%location of event-block%} to true
  89. set {_tier} to "Tier I"
  90. if clicked block is smooth stone:
  91. set {anvil.%location of event-block%.tier} to 1
  92. else if clicked block is iron block:
  93. set {anvil.%location of event-block%.tier} to 2
  94. set {_tier} to "Tier II"
  95. else:
  96. set {anvil.%location of event-block%.tier} to 3
  97. set {_tier} to "Tier III"
  98.  
  99. set {_s} to 6
  100. loop all players in radius 6 around event-block:
  101. set {_v} to ({_s} - distance between loop-player and event-block)
  102. play sound "block.anvil.place" with volume {_v} and pitch 0 to loop-player
  103.  
  104. send "{@logo} Successfully created an anvil of %{_tier}%."
  105. summon armor stand at location 0.6 meters below event-block
  106. set name of last spawned armor stand to "&7Anvil"
  107. add "{Invisible:1b,NoGravity:1b,NoAI:1b,CustomNameVisible:1}" to NBT of last spawned armor stand
  108.  
  109. summon armor stand at location 0.9 meters below event-block
  110. set name of last spawned armor stand to "&7%{_tier}%"
  111. add "{Invisible:1b,NoGravity:1b,NoAI:1b,CustomNameVisible:1}" to NBT of last spawned armor stand
  112.  
  113. else if clicked block is cauldron:
  114. if isFurnace1(location 1 meters below clicked block):
  115. set {furnace.%location of event-block%} to true
  116.  
  117. else if clicked block is blast furnace:
  118. if isFurnace2(location of clicked block):
  119. set {furnace2.%location of event-block%} to true
  120.  
  121. on break of smooth stone or iron block or diamond block:
  122. if {anvil.%location of event-block%} is true:
  123. set {_s} to 6
  124. loop all players in radius 6 around event-block:
  125. set {_v} to ({_s} - distance between loop-player and event-block)
  126. play sound "block.anvil.place" with volume {_v} and pitch 0 to loop-player
  127. delete {anvil.%location of event-block%}
  128. delete {anvil.%location of event-block%.tier}
  129. loop entities in radius 1 around event-block:
  130. if type of loop-entity is armor stand:
  131. kill loop-entity
  132.  
  133.  
  134. on inventory click:
  135. if type of clicked inventory is chest inventory:
  136. if inventory name of player's current inventory is "&8Anvil":
  137. cancel event
  138.  
  139. command /stair:
  140. trigger:
  141. send "%block 1 meters below player%"
  142.  
Add Comment
Please, Sign In to add comment