Advertisement
maxtorcd55

miner2

Jun 19th, 2014
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.61 KB | None | 0 0
  1. local function getblock(namea,numa)
  2.         turtle.select(16)
  3.         turtle.place()
  4.  
  5.  
  6.  
  7.         local allyfind = true
  8.         while allyfind do
  9.                 local EnderStacks = peripheral.call("front","getAllStacks")
  10.                 local EnderSize = peripheral.call("front","getInventorySize")
  11.                 local EnderChest = peripheral.wrap("front")
  12.                 for i=1, EnderSize do
  13.                         if EnderStacks[i] ~= nil then
  14.                                 if string.find(string.lower(EnderStacks[i]["name"]), namea) and allyfind then
  15.                                         allyfind = false
  16.                                         EnderChest.pushItemIntoSlot("east",i,numa)
  17.                                 end
  18.                         end
  19.                 end
  20.         sleep(1)
  21.         print(allyfind)
  22.         print(namea)
  23.         end
  24.         turtle.select(16)
  25.         turtle.dig()
  26.         turtle.select(1)
  27.        
  28. end
  29.  
  30.  
  31. local function fuelCheck()
  32.         print(turtle.getFuelLevel())
  33.         if turtle.getFuelLevel() < 100 then
  34.                 getblock("coal",30)
  35.                 turtle.refuel(64)
  36.  
  37.                 print(turtle.getFuelLevel())
  38.         end
  39.        
  40. end
  41.  
  42.  
  43. local function clearinv()
  44.  
  45.         if turtle.getItemCount(1) > 0 then
  46.         turtle.select(16)
  47.             turtle.place()
  48.             for i=1, 12 do
  49.                     turtle.select(i)
  50.                     turtle.drop(64)
  51.             end      
  52.         end
  53.         turtle.select(16)
  54.         turtle.dig()
  55.        
  56. end
  57.  
  58.  
  59. while true do
  60.     fuelCheck()
  61.     clearinv()
  62.     turtle.digDown()
  63.     turtle.forward()
  64.     sleep(120)
  65. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement