Advertisement
Alakazard12

Wither

Jul 2nd, 2016
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.78 KB | None | 0 0
  1. local sand = {}
  2. local skull = {}
  3.  
  4. for i = 1, 16 do
  5.   local t = turtle.getItemDetail(i)
  6.   if t then
  7.     if t.name == "minecraft:soul_sand" then
  8.       sand[i] = t.count
  9.     elseif t.name == "minecraft:skull" then
  10.       skull[i] = t.count
  11.     end
  12.   end
  13. end
  14.  
  15. local function place()
  16.   while not turtle.place() do sleep(0.05) end
  17. end
  18.  
  19. local skullSelected, sandSelected
  20. local function placeSkull()
  21.   if not skullSelected or skull[skullSelected] == 0 then
  22.     if skullSelected then
  23.       skull[skullSelected] = nil
  24.     end
  25.     skullSelected = nil
  26.     for pos, c in pairs(skull) do
  27.       if c > 0 then
  28.         skullSelected = pos
  29.       end
  30.     end
  31.   end
  32.  
  33.   if not skullSelected then
  34.     print("out of skulls")
  35.   else
  36.     turtle.select(skullSelected)
  37.     place()
  38.     skull[skullSelected] = skull[skullSelected] - 1
  39.   end
  40. end
  41.  
  42. local function placeSand()
  43.   if not sandSelected or sand[sandSelected] == 0 then
  44.     if sandSelected then
  45.       sand[sandSelected] = nil
  46.     end
  47.     sandSelected = nil
  48.     for pos, c in pairs(sand) do
  49.       if c > 0 then
  50.         sandSelected = pos
  51.       end
  52.     end
  53.   end
  54.  
  55.   if not sandSelected then
  56.     print("out of sand")
  57.   else
  58.     turtle.select(sandSelected)
  59.     place()
  60.     sand[sandSelected] = sand[sandSelected] - 1
  61.   end
  62. end
  63.  
  64. local function up()
  65.   while not turtle.up() do sleep(0.05) end
  66. end
  67.  
  68. local function down()
  69.   while not turtle.down() do sleep(0.05) end
  70. end
  71.  
  72. local function back()
  73.   while not turtle.back() do sleep(0.05) end
  74. end
  75.  
  76. local function forward()
  77.   while not turtle.forward() do sleep(0.05) end
  78. end
  79.  
  80. placeSand()
  81. up()
  82. forward()
  83. placeSand()
  84. back()
  85. placeSand()
  86. back()
  87. placeSand()
  88. up()
  89. forward()
  90. forward()
  91. placeSkull()
  92. back()
  93. placeSkull()
  94. back()
  95. placeSkull()
  96. down()
  97. down()
  98. forward()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement