Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- local xSize = tonumber(args[2])
- local ySize = tonumber(args[1])
- local timeout = tonumber(args[3])
- local function checkWheat()
- local isBlock, data = turtle.inspectDown()
- if isBlock and data.name == "minecraft:wheat" and data.metadata == 7 then
- turtle.digDown()
- turtle.select(1)
- turtle.placeDown()
- end
- end
- local function refuelIfEmpty() -- refuels if fuel level is 0
- if turtle.getFuelLevel() == 0 then
- print('Out of fuel\nWaiting for fuel in slot ' .. turtle.getSelectedSlot() .. '...')
- while not turtle.refuel do os.pullEvent('turtle_inventory') end
- print('Fuel level is: ' .. turtle.getFuelLevel())
- end
- end
- local function forward()
- checkWheat()
- while not turtle.forward() do
- refuelIfEmpty()
- if turtle.detect() then turtle.dig() end
- end
- end
- local function doPass()
- for n = 1, ySize do
- for m = 1, xSize -1 do
- forward()
- end
- if n < ySize then
- if n % 2 == 0 then
- turtle.turnRight()
- forward()
- turtle.turnRight()
- else
- turtle.turnLeft()
- forward()
- turtle.turnLeft()
- end
- end
- end
- if ySize % 2 ~= 0 then
- turtle.turnRight()
- turtle.turnRight()
- for n = 1, xSize -1 do
- turtle.forward()
- end
- end
- turtle.turnLeft()
- for n = 1, ySize -1 do
- turtle.forward()
- end
- end
- local function useChest()
- for n = 2, 16 do
- turtle.select(n)
- turtle.drop()
- end
- end
- while true do
- doPass()
- turtle.turnRight()
- useChest()
- turtle.turnRight()
- turtle.turnRight()
- sleep(timeout or 25*60)
- end
Add Comment
Please, Sign In to add comment