Advertisement
punchin

CC_BlazeSpawner

Dec 17th, 2014
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.23 KB | None | 0 0
  1. --[[ Blaze spawner builder for Minecraft mod: Computercraft ]]--
  2. --[[                     Made by Punchin                    ]]--
  3.  
  4. local invCount = 0
  5.  
  6. local function cls() --Clears the screen
  7.     term.clear()
  8.     term.setCursorPos(1,1)
  9. end
  10.  
  11. local function iCount() --Counts total inventory items
  12.     invCount = 0
  13.     for i=1,16 do
  14.         invCount = invCount + turtle.getItemCount(i)
  15.     end
  16. end
  17.  
  18. local function inv() --Keeps items in slot 1
  19.     if (turtle.getItemCount(1) == 1) then
  20.         for z=2,16 do
  21.             if (turtle.getItemCount(z) > 0) then
  22.                 turtle.select(z)
  23.                 if turtle.compareTo(1) then
  24.                     turtle.transferTo(1)
  25.                     turtle.select(1)
  26.                     break
  27.                 end
  28.             end
  29.         end
  30.     end
  31.     iCount()
  32.     term.setCursorPos(1,3)
  33.     print("                         ")
  34.     term.setCursorPos(1,3)
  35.     print("Items in inventory: " .. invCount)
  36. end
  37.  
  38. --Movement functions
  39. local function mf() while not turtle.forward() do turtle.attack() turtle.dig() end end
  40. local function mu() while not turtle.up() do turtle.digUp() turtle.attackUp() end end
  41. local function md() while not turtle.down() do turtle.digDown() turtle.attackDown() end end
  42. local function du() turtle.digUp() end
  43. local function dd() turtle.digDown() end
  44. local function dig() turtle.dig() end
  45. local function tr() turtle.turnRight() end
  46. local function tl() turtle.turnLeft() end
  47. local function mb() while not turtle.back() do tr() tr() mf() tr() tr() end end
  48. local function pu() while not turtle.placeUp() do du() turtle.attackUp() end inv() end
  49. local function pd() while not turtle.placeDown() do dd() turtle.attackDown() end inv() end
  50.  
  51. iCount()
  52.  
  53. while (invCount < 343) do --Initial check for item count.
  54.     cls()
  55.     print("Not enough items.")
  56.     print("Please add " .. (343 - invCount) .. " items.")
  57.     sleep(1)
  58.     iCount()
  59. end
  60.  
  61. cls()
  62.  
  63. print("All items accounted for.") --Beginning build
  64. print("Beginning build.")
  65.  
  66. --Moving into position for bottom platform
  67. tl()
  68. for i=1,4 do mf() end
  69. tl()
  70. for i=1,3 do mf() end
  71. tl()
  72. md()
  73. md()
  74.  
  75. --Building bottom platform and clearing 2 below spawner
  76. du() dd() pd()
  77. for j=1,4 do
  78.     for i=1,8 do mf() du() dd() pd() end
  79.     tl() mf() du() dd() tl() pd()
  80.     for i=1,8 do mf() du() dd() pd() end
  81.     tr() mf() du() dd() tr() pd()
  82. end
  83. for i=1,8 do mf() du() dd() pd() end
  84.  
  85. --Moving to top platform and clearing 2 above spawner
  86. mu() mu() mu() mu() tr() tr() pu()
  87. for j=1,4 do
  88.     for i=1,8 do mf() du() dd() pu() end
  89.     tl() mf() du() dd() tl() pu()
  90.     for i=1,8 do mf() du() dd() pu() end
  91.     tr() mf() du() dd() tr() pu()
  92. end
  93. for i=1,8 do mf() du() dd() pu() end
  94.  
  95. mf() tr()
  96.  
  97. --Building walls
  98. for s=1,4 do
  99.     for r=1,4 do
  100.         for i=1,5 do md() pu() end
  101.         mf() mu()
  102.         for i=1,5 do mu() pd() end
  103.         mf() md()
  104.     end
  105.     for i=1,5 do md() pu() end
  106.     mf() for i=1,5 do mu() end
  107.     tr() mf()
  108. end
  109.  
  110. --Repairing hole used to enter spawner area
  111. tl() mb() turtle.place()
  112. md() md() tr()
  113.  
  114. --Clearing leftover blocks inside spawner room
  115. for i=1,4 do
  116.     for j=1,8 do
  117.         mf()
  118.     end
  119.     tr()
  120. end
  121.  
  122. mf() tr() mf() tl()
  123.  
  124. for i=1,4 do
  125.     for j=1,6 do
  126.         mf()
  127.     end
  128.     tr()
  129. end
  130.  
  131. mf() tr() mf() tl()
  132.  
  133. for i=1,4 do
  134.     for j=1,4 do
  135.         mf()
  136.     end
  137.     tr()
  138. end
  139.  
  140. --creating doorway and exiting spawner room
  141. tr() tr() mf() mf()
  142. tl() mf() mf() tr()
  143. md() mf() md() pd()
  144. mf() md()
  145.  
  146. cls()
  147. print("Spawner complete. Enjoy!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement