trainworld_computercraft/computer/3/felling.lua
2025-05-22 20:51:25 +02:00

45 lines
1,002 B
Lua

trees = {
vector.new(-261, 95, 119),
vector.new(-258, 95, 124),
vector.new(-264, 95, 124),
vector.new(-265, 95, 121),
vector.new(-263, 94, 116),
vector.new(-265, 94, 107),
vector.new(-263, 94, 104),
vector.new(-261,94,94),
vector.new(-259,94,100),
vector.new(-257,94,103)
}
pf = require("pathfinding")
im = require("inventorymanager")
function fell(index)
im.select("minecraft:birch_sapling")
print("going towards tree")
pf.lookat(trees[index or math.random(#trees)])
has, data = turtle.inspect()
print(has,data)
if
has and data.name ==
"minecraft:birch_log"
then
turtle.dig()
turtle.forward()
height = 0
while turtle.digUp() do
turtle.up()
height = height + 1
end
for i = 1,height do
turtle.down()
end
turtle.back()
end
turtle.place()
end
for i = 1,#trees do
fell(i)
end
pf.returnHome()