Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function itemInSlot (slot)
- turtle.select(slot)
- local data = turtle.getItemDetail()
- if data then
- return true
- else
- return false
- end
- end
- function checkForCrop ()
- if turtle.detectDown() then
- local success, data = turtle.inspectDown()
- if success then
- if data.name == "minecraft:wheat" and data.metadata == 7 then
- turtle.digDown()
- turtle.select(1)
- turtle.placeDown()
- end
- end
- else
- turtle.digDown()
- turtle.select(1)
- turtle.placeDown()
- end
- end
- function farmRow(rowLength)
- for x=1,rowLength do
- turtle.forward()
- checkForCrop()
- end
- end
- function chestSort ()
- for x=1,16 do
- if itemInSlot(x) then
- itemData = turtle.getItemDetail()["name"]
- if itemData == "minecraft:log" then
- print("Fuel detected")
- turtle.refuel(turtle.getItemCount(x))
- elseif x ~= 1 then
- turtle.drop()
- end
- end
- end
- return "Chest Sort Complete"
- end
- while true do
- turtle.turnRight()
- --Zig Zag Begins
- for x=2,9 do
- if x%2 == 0 then
- farmRow(8)
- turtle.turnRight()
- farmRow(1)
- turtle.turnRight()
- else
- farmRow(8)
- turtle.turnLeft()
- farmRow(1)
- turtle.turnLeft()
- end
- end
- -- End sequence to return to base
- farmRow(8)
- turtle.turnLeft()
- farmRow(8)
- turtle.turnLeft()
- farmRow(8)
- turtle.turnRight()
- chestSort()
- os.sleep(10000)
- end
Advertisement
Add Comment
Please, Sign In to add comment