Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local a = {}
- local args = {...}
- local xSize = args[1]
- local zSize = args[2]
- local xPos = 0
- local zPos = 0
- local xDiff = 0
- local yDiff = 0
- local xTemp = 0
- local zTemp = 0
- local slot = 1
- local foundSeed = false
- function a.goToPlace(x,z)
- xDiff = xPos-x
- zDiff = zPos-z
- if xDiff ~=0 then
- turtle.turnRight()
- while xDiff ~= 0 do
- if xDiff<0 then
- turtle.back()
- xDiff = xDiff+1
- xPos = xPos+1
- end
- if xDiff > 0 then
- turtle.forward()
- xDiff = xDiff-1
- xPos = xPos-1
- end
- end
- turtle.turnLeft()
- end
- while zDiff ~= 0 do
- if zDiff<0 then
- turtle.forward()
- zDiff = zDiff+1
- zPos = zPos+1
- end
- if zDiff>0 then
- turtle.back()
- zDiff = zDiff-1
- zPos = zPos-1
- end
- end
- end
- function a.plantSeed()
- if turtle.getItemDetail(slot) == nil then
- foundSeed = false
- while(foundSeed ~= true) and(slot~=17) do
- print(slot)
- if(turtle.getItemDetail(slot) ~= nil) then
- if(turtle.getItemDetail(slot).name=="minecraft:wheat_seeds") then
- foundSeed = true
- end
- else
- slot = slot+1
- end
- end
- end
- if(slot==17)then
- slot = 1
- xTemp = xPos
- zTemp = zPos
- a.goToPlace(0,0)
- print("Please give me seeds")
- while(foundSeed ~= true)do
- if(turtle.getItemDetail(slot) ~= nil) then
- if(turtle.getItemDetail(slot).name=="minecraft:wheat_seeds") then
- foundSeed = true
- sleep(1)
- end
- end
- end
- print("Thank you!")
- a.goToPlace(xTemp,zTemp)
- else
- turtle.placeDown()
- end
- end
- while(turtle.getFuelLevel()>(xSize*zSize*2))do
- for x = 0, xSize do
- for z = 0, zSize do
- if x % 2 == 1 then
- a.goToPlace(x,(zSize-z))
- end
- if x % 2 == 0 then
- a.goToPlace(x,z)
- end
- turtle.digDown()
- a.plantSeed()
- end
- end
- a.goToPlace(0,0)
- sleep(1200)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement