created treeFarmer
This commit is contained in:
parent
53ffa8fd19
commit
22da385249
45
src/main/programs/turtle-treeFarmer.lua
Normal file
45
src/main/programs/turtle-treeFarmer.lua
Normal file
@ -0,0 +1,45 @@
|
||||
woodList = {
|
||||
[0] = "minecraft:oak_log",
|
||||
[1] = "minecraft:dark_oak_log",
|
||||
[2] = "minecraft:spruce_log",
|
||||
}
|
||||
|
||||
local function isWood(blockData)
|
||||
for i=0, #woodList do
|
||||
if blockData["name"] == woodList[i] then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function placeTree()
|
||||
for i=1, 16 do
|
||||
turtle.select(i)
|
||||
local itemDetail = turtle.getItemDetail()
|
||||
|
||||
if itemDetail ~= nil then
|
||||
if itemDetail.name == "minecraft:oak_sapling" then
|
||||
local blockFound, blockData = turtle.inspect()
|
||||
if not blockFound then
|
||||
turtle.place()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function main()
|
||||
while true do
|
||||
blockFound, blockData = turtle.inspect()
|
||||
if isWood(blockData) then
|
||||
turtle.dig()
|
||||
sleep(1)
|
||||
placeTree()
|
||||
end
|
||||
sleep(10)
|
||||
print("waiting...")
|
||||
end
|
||||
end
|
||||
|
||||
main()
|
Loading…
Reference in New Issue
Block a user