Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tree
- local bool
- local y = 0
- local saplingCount
- -- forestry:sapling_ge
- -- forestry:logs.0
- -- metadata 3
- local saplingTable = {
- "minecraft:sapling",
- "forestry:sapling_ge",
- "forestry:sapling"
- }
- local logTable = {
- "minecraft:log",
- "forestry:logs.0"
- }
- function validSapling(val)
- for index, value in ipairs(saplingTable) do
- if value == val then
- return true
- end
- end
- return false
- end
- function validLog(val)
- for index, value in ipairs(logTable) do
- if value == val then
- return true
- end
- end
- return false
- end
- while true do
- print("looping")
- turtle.select(1)
- if turtle.getSelectedSlot(1) then
- local data = turtle.getItemDetail()
- if validSapling(data.name) == false then
- print("no saplings found in slot 1")
- return
- else
- saplingCount = data.count
- end
- end
- repeat
- if turtle.detect() or turtle.place() then
- pBool = true
- end
- print("attempting to place")
- until pBool == true
- repeat
- bool,tree = turtle.inspect()
- print("inspecting")
- os.sleep(10)
- until validLog(tree.name)
- if turtle.getFuelLevel() < 10 then
- print("OUT OF FUEL")
- return
- end
- turtle.dig()
- turtle.forward()
- while turtle.detectUp() == true do
- print("Chopping")
- for i=1,4 do
- turtle.dig()
- turtle.turnLeft()
- end
- turtle.digUp()
- turtle.up()
- y = y + 1
- end
- while y > 0 do
- print("returning")
- turtle.down()
- y = y - 1
- end
- turtle.back()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement