Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x = tArgs[1]
- y = tArgs[2]
- function fSubforward()
- repeat
- bGo = turtle.forward()
- if bGo == false then
- if turtle.getFuelLevel() == 0 then
- print('Out of fuel. checking for fuel now...')
- repeat
- bFuel = turtle.refuel()
- sleep(1)
- until bFuel == true
- elseif turtle.detect() == true then
- print("...that block isn't supposed to be there. Move it out of my way to continue farming.")
- repeat
- bBlock = turtle.detect()
- sleep(1)
- until bBlock == false
- else
- print("Could not diagnose movement issue. Terminating with error.")
- error("Forward Issue Diagnostic failure")
- end
- end
- until bGo == true
- end
- function fSscan()
- for i = 1, 15 do
- tData = turtle.getItemDetail(i)
- if tData.name == "minecraft:wheat" then
- if i == 1 then
- turtle.select(1)
- for j = 2, 15 do
- tSdata = turtle.getItemDetail(j)
- nCnt = turtle.getItemCount(j)
- if nCnt == 0 or tSdata.name == tData.name and nCnt+turtle.getItemCount() < 64 then
- turtle.transferTo(j)
- break
- end
- end
- end
- turtle.select(i)
- else
- turtle.select(i)
- turtle.transferTo(1)
- turtle.select(1)
- break
- end
- end
- end
- function fSforward()
- _, tMeta = turtle.inspectDown()
- if tMeta.metadata == 7 then
- turtle.digDown()
- fSscan()
- turtle.placeDown()
- elseif tMeta.metadata == nil then
- turtle.placeDown()
- end
- fSubforward()
- end
- function fDnS()
- for i = 2, 15 do
- turtle.select(i)
- repeat
- bFull = turtle.drop()
- if bFull == false and turtle.getItemCount() ~= 0 then
- print('Get your Wheat you lazy scum!')
- sleep(1)
- else
- break
- end
- until bFull == true
- end
- turtle.select(1)
- turtle.turnRight()
- turtle.forward()
- end
- function fFuelcheck(l, w)
- if w/2 == math.ceil(w/2) then
- nFuelR = (l*(w+1))+w+l+1
- else
- nFuelR = (l*(w+1))+w+1
- end
- nCurFuel = turtle.getFuelLevel()
- if nCurFuel < nFuelR then
- turtle.select(16)
- turtle.suck() --gives chest that nice succ
- repeat
- bFuelup = turtle.refuel(1)
- if bFuelup == false then
- sleep(1)
- end
- until nCurFuel <= nFuelR
- turtle.drop()
- turtle.select(1)
- end
- end
- function fMkui()
- term.setBackgroundColor(colors.lightBlue)
- term.clear()
- term.setTextColor(colors.white)
- term.setCursorPos(1, 1)
- print(' _ _')
- print(' .-./*) |------| (*\\.-.')
- print(' _/___\\/ || \\/___\\_')
- print(' U U ||ARTLE U U')
- end
- function fFarm()
- fMkui()
- term.setCursorPos(1, 6)
- fFuelcheck(tArgs[1], tArgs[2])
- for i = 1, y+1 do
- for j = 1, x do
- fSforward()
- end
- if i/2 ~= math.ceil(i/2) and i ~= y+1 then
- for i = 1, 2 do
- turtle.turnRight()
- fSubforward()
- end
- elseif i ~= y+1 then
- for i = 1, 2 do
- turtle.turnLeft()
- fSubforward()
- end
- else
- if (i-1)/2 == math.ceil((i-1)/2) then
- turtle.turnLeft()
- for j = 1, y do
- fSubforward()
- end
- turtle.turnLeft()
- for j = 1, x+1 do
- fSubforward()
- end
- turtle.turnRight()
- fDnS()
- else
- turtle.turnRight()
- for j = 1, y do
- fSubforward()
- end
- fDnS()
- end
- end
- end
- end
- fFarm()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement