Advertisement
CreeperNukeBoom

Lumberjack

Jan 26th, 2020
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.05 KB | None | 0 0
  1. --Lumberjack turtle program
  2. --turtles cnnot go forward onto saplings as it considers the sapling an obstruction.
  3.  
  4. local chest = peripheral.find("minecraft:chest")
  5. local chestName = "minecraft:chest_3500"
  6. local chestdir = "south"
  7. local modem = peripheral.find("modem")
  8. local turtleNetName = modem.getNameLocal()
  9. chest.pullItems(turtleNetName,2,64)
  10.  
  11. local moveCount=0
  12. --local chest = "minecraft:chest_14"
  13. local success
  14. local data
  15.  
  16. success, data = turtle.inspect()
  17. if data.name =="minecraft:log" then
  18.   turtle.dig()
  19.   turtle.digUp()
  20.   turtle.up()
  21.   moveCount = moveCount + 1
  22. else
  23.   repeat until not turtle.down()
  24. end
  25. if data.name ~= "minecraft:sapling" then
  26.   turtle.select(1)
  27.   turtle.place()
  28. end
  29.  
  30. --repeat until not turtle.down()
  31.  
  32.  
  33. while true do
  34.   turtle.select(3)
  35.   if turtle.getFuelLevel() == 0 then turtle.refuel(1) end
  36.   turtle.select(2)
  37.   repeat
  38.     success, data = turtle.inspect()
  39.   until data.name == "minecraft:log"
  40.   -- if success then
  41.     -- print("Block name: ", data.name)
  42.     -- print("Block metadata: ", data.metadata)
  43.   -- end
  44.   turtle.dig()
  45.   turtle.forward()
  46.   turtle.digUp()
  47.   turtle.up()
  48.   success2 , blockcheck = turtle.inspectUp()
  49.   if blockcheck.name == "minecraft:log" then
  50.     repeat
  51.       turtle.digUp()
  52.       turtle.up()
  53.       success2 , blockcheck = turtle.inspectUp()
  54.     until blockcheck.name ~= "minecraft:log"
  55.   end
  56.   -- else
  57.     -- repeat
  58.       -- --sleep(1)
  59.       -- repeat
  60.       -- turtle.suck()
  61.       -- success, data = turtle.inspect()
  62.       -- until data.name == "minecraft:log"
  63.       -- turtle.dig()
  64.       -- turtle.digUp()
  65.       -- turtle.up()
  66.       -- moveCount = moveCount + 1
  67.     -- until data.name ~= "minecraft:log"
  68.   -- for move = 1 , moveCount do
  69.     -- turtle.down()
  70.   -- end
  71.   repeat until not turtle.down()
  72.   turtle.back()
  73.   turtle.select(1)
  74.   turtle.place()
  75.   turtle.select(2)
  76.   chest.pullItems(turtleNetName,2,64)
  77.   -- peripheral.call("minecraft:hopper_1","pushItems","turtle_0",1)
  78.   -- chest = peripheral.wrap("minecraft:chest_14")
  79.   -- chest.pullItems("turtle_0",2)
  80. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement