Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function checkAge()
- isBlock, data = turtle.inspect()
- if (data['state']['age'] == 7)
- then
- isgrown = true
- elseif (data['state']['age'] ~= 7)
- then
- isgrown = false
- end
- end
- function waitForGrowth()
- checkAge()
- while isgrown == false do
- sleep(5)
- checkAge()
- end
- end
- function getFuelIndex()
- for slotNum = 1, 16, 1 do
- local Item = turtle.getItemDetail(slotNum)
- if(Item ~=nil) then
- if(Item["name"] == "minecraft:coal_block" or Item["name"] == "actuallyadditions:block_misc" or Item["name"] == "quark:charcoal_block") then
- return slotNum
- end
- end
- end
- end
- function refuel()
- if(turtle.getFuelLevel() < 400) then
- Index = getFuelIndex()
- if(Index ~= nil) then
- turtle.select(Index)
- turtle.refuel(2)
- end
- end
- end
- function getCarrotIndex()
- for slotNum = 1, 16, 1 do
- local item = turtle.getItemDetail(slotNum)
- if(item ~=nil) then
- if(item["name"] == "minecraft:carrot") then
- return slotNum
- end
- end
- end
- end
- function harvest()
- turtle.dig()
- turtle.suck()
- index = getCarrotIndex()
- turtle.select(index)
- turtle.place()
- local carrotNum = turtle.getItemCount() - 1
- turtle.dropDown(carrotNum)
- end
- function goLeft()
- turtle.turnLeft()
- local isBlock = turtle.detect()
- if isBlock == true then
- state, tags = turtle.inspect()
- if (tags.name == "quark:oak_chest") then
- getFuelIndex()
- local coalBlocks = turtle.getItemCount()
- if coalBlocks <= 4 then
- turtle.suck(30)
- turtle.turnLeft()
- waitForGrowth()
- harvest()
- end
- elseif (tags.name ~= "quark:oak_chest") == false then
- turtle.forward()
- turtle.turnRight()
- end
- elseif isBlock ~= true then
- turtle.forward()
- turtle.turnRight()
- end
- end
- while true do
- goLeft()
- harvest()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement