Skip to content

Instantly share code, notes, and snippets.

@Nathan22211
Forked from Citrus34/Lumberjack.lua
Last active December 22, 2024 18:49
Show Gist options
  • Save Nathan22211/ff060c75874d15e3261a0ccb9f1713d9 to your computer and use it in GitHub Desktop.
Save Nathan22211/ff060c75874d15e3261a0ccb9f1713d9 to your computer and use it in GitHub Desktop.
Extremely basic tree harvesting for turtles in CC: Tweaked
function fuelCheck()
if turtle.getFuelLevel() <20 then
turtle.select(1)
turtle.refuel()
print("Refueling...")
end
end
local logs = {
["forge:logs"] = true,
["minecraft:spruce_log"] = true,
["minecraft:oak_log"] = true,
["minecraft:birch_log"] = true
}
while true do
local isPresent, blockData = turtle.inspect()
if logs[blockData.name] then
fuelCheck()
print("Beginning Harvesting...")
while turtle.detect() do
turtle.dig()
turtle.suck()
turtle.digUp()
--turtle.up()
end
while not turtle.detectDown() do
print("Moving down...")
turtle.down()
end
end
turtle.select(2)
item = turtle.getItemDetail(2)
if item and item.name:find("sapling") then
turtle.place()
end
turtle.suck()
turtle.turnLeft()
turtle.suck()
turtle.turnLeft()
turtle.suck()
turtle.turnLeft()
turtle.suck()
turtle.turnLeft()
turtle.select(3)
turtle.dropDown()
turtle.select(4)
turtle.dropDown()
turtle.select(5)
turtle.dropDown()
turtle.select(6)
turtle.dropDown()
turtle.select(7)
turtle.dropDown()
turtle.select(8)
turtle.dropDown()
end
print("Completed Harvesting, Dropping Materials...")
print("Dropping completed, waiting fo rnew tree to grow...")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment