dealingwith

stone_block_crafter

Jul 16th, 2017
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.18 KB | None | 0 0
  1. -- turtle.craft(number quantity ( if not supplied will craft as many as possible ))
  2. -- turtle.select(number slotNumber (1-16 in ComputerCraft 1.4+, otherwise 1-9))
  3. -- turtle.getItemCount(slot)
  4. -- turtle.suckDown([number amount])
  5.   -- boolean true if at least one item was moved into the turtle's inventory; false otherwise.
  6.  
  7. function craft_and_drop()
  8.   turtle.select(16)
  9.   turtle.craft()
  10.   turtle.turnRight()
  11.   turtle.turnRight()
  12.   turtle.drop()
  13.   turtle.turnRight()
  14.   turtle.turnRight()
  15. end
  16.  
  17. function dump(start_point,end_point)
  18.   for i=start_point,end_point,1 do
  19.     turtle.select(i)
  20.     turtle.dropDown()
  21.   end
  22. end
  23.  
  24. while true do
  25.   dump(1,16)
  26.   turtle.select(1)
  27.   turtle.suckDown(64)
  28.   local blockcount = turtle.getItemCount(1)
  29.   if blockcount > 3 then
  30.     -- spread blocks out evenly
  31.     local each_slot_count = math.floor(blockcount / 4)
  32.     turtle.dropDown()
  33.     turtle.suckDown(each_slot_count)
  34.     turtle.select(2)
  35.     turtle.suckDown(each_slot_count)
  36.     turtle.select(5)
  37.     turtle.suckDown(each_slot_count)
  38.     turtle.select(6)
  39.     turtle.suckDown(each_slot_count)
  40.     craft_and_drop()
  41.   else
  42.     print('Waiting 5 min')
  43.     os.sleep(300) -- 5 min
  44.   end
  45. end
Advertisement
Add Comment
Please, Sign In to add comment