Skip to content

Instantly share code, notes, and snippets.

@jarrydstan
Last active June 15, 2021 14:12
Show Gist options
  • Save jarrydstan/33f98793f72fac8936a23829420decb4 to your computer and use it in GitHub Desktop.
Save jarrydstan/33f98793f72fac8936a23829420decb4 to your computer and use it in GitHub Desktop.
Transfers wood from chest to furnace
local SLOT_COUNT = 16
function getItemIndex(itemName)
for slot = 1, SLOT_COUNT, 1 do
local item = turtle.getItemDetail(slot)
if(item ~= nil) then
if(string.match(item.name, itemName)) then
return slot
end
end
end
end
function getWood()
turtle.suck()
while(true) do
woodIndex = getItemIndex("log")
if(woodIndex == nil) then
turtle.suck()
turtle.drop()
else
turtle.select(woodIndex)
turtle.dropUp()
return true
end
end
return true
end
function orientate()
while true do
x, table = turtle.inspect()
if not string.match( table.name,"chest" ) then
turtle.turnLeft()
else
return true
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment