Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("left")
- local mainID = 15
- local function forward(count)
- for k = 1,count do
- turtle.forward()
- end
- end
- local function goUp(count)
- for k = 1,count do
- turtle.up()
- end
- end
- local function goDown(count)
- for k = 1,count do
- turtle.down()
- end
- end
- while true do
- while turtle.getItemCount() == 0 do --Get items
- if not turtle.suck() then
- rednet.send(mainID, "home")
- sleep(.5)
- local a = 5
- while a ~= 0 do
- rednet.send(mainID, tostring(a))
- sleep(60)
- end
- rednet.send(mainID, tostring(a))
- end
- end
- rednet.send(mainID, "away")
- local data = turtle.getItemDetail()
- if data.name == "minecraft:log" then --Sort logs
- turtle.turnRight()
- turtle.turnRight()
- forward(8)
- turtle.turnLeft()
- goDown(2)
- if not turtle.drop() then --Try to put in one of 3 chests
- goDown(1)
- if not turtle.drop() then
- turtle.dropDown()
- goUp(1)
- end
- goUp(1)
- end
- goUp(2)
- turtle.turnLeft()
- forward(8)
- elseif data.name == "minecraft:sapling" then --Sort saplings
- turtle.turnRight()
- goDown(2)
- if not turtle.drop() then
- goDown(1)
- if not turtle.drop() then
- turtle.dropDown()
- end
- goUp(1)
- end
- goUp(2)
- elseif data.name == "minecraft:coal" then --Sort charcoal, refuel if needed
- if turtle.getFuelLevel() < (turtle.getFuelLimit() - 5120) then
- turtle.refuel()
- else
- goDown(3)
- turtle.dropDown()
- goUp(3)
- end
- else --Sort everything else
- turtle.turnRight()
- turtle.turnRight()
- forward(8)
- turtle.turnLeft()
- goDown(4)
- if not turtle.drop() then
- turtle.dropDown()
- end
- goUp(4)
- turtle.turnLeft()
- forward(8)
- end
- end
- rednet.close("left")
Advertisement
Add Comment
Please, Sign In to add comment