Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- 11 X 11 farm
- ]]--
- os.loadAPI("tst")
- stroke= true
- run = true
- local function getFreeSlot()
- for slot=1,16 do
- if turtle.getItemCount(slot) == 0 then
- return slot
- end
- end
- end
- local function seedsToOne()
- for slot=1,16 do
- data = turtle.getItemDetail(slot)
- if data ~= nil then
- if data["name"] == "minecraft:wheat_seeds" then
- turtle.select(slot)
- turtle.transferTo(1)
- end
- end
- end
- end
- local function moveIone()
- turtle.select(1)
- free=getFreeSlot()
- turtle.transferTo(free)
- end
- function organize()
- moveIone()
- seedsToOne()
- end
- function doFarm(x,y)
- if x == 6 and y == 6 then
- return true
- end
- local success, data = turtle.inspectDown()
- if success then
- if data.name == "minecraft:fence" then
- os.shutdown()
- else
- if data.metadata == 7 then
- turtle.digDown()
- organize()
- turtle.select(1)
- turtle.placeDown()
- else
- return false
- end
- end
- else
- turtle.digDown()
- turtle.select(1)
- turtle.placeDown()
- return false
- end
- end
- function goToStart()
- tst.turnAround()
- for i=1,10 do
- tst.forward()
- end
- tst.turnRight()
- for i=1,10 do
- tst.forward()
- end
- tst.turnRight()
- x,y,z = tst.getLocation()
- print(x..";"..y..";"..z)
- end
- function doLine(x)
- for y=1,10 do
- doFarm(x,y)
- tst.forward()
- end
- end
- function emptyInf()
- organize()
- tst.turnAround()
- for slot=2,16 do
- turtle.select(slot)
- data = turtle.getItemDetail()
- if data ~= nil then
- turtle.drop()
- end
- end
- tst.turnRight()
- tst.turnRight()
- end
- function waitForEnd()
- while true do
- local event, key = os.pullEvent( "key" )
- if key == keys.e then
- return
- end
- end
- end
- function main()
- while run do
- organize()
- for x=1,10 do
- doLine(x)
- if stroke then
- doFarm(x,11)
- tst.turnRight()
- tst.forward()
- tst.turnRight()
- stroke = false
- else
- doFarm(x,0)
- tst.turnLeft()
- tst.forward()
- tst.turnLeft()
- stroke = true
- end
- end
- doLine(11)
- doFarm(11,11)
- goToStart()
- emptyInf()
- sleep(120)
- end
- end
- tst.manSetLocation(0,0,0)
- parallel.waitForAny(waitForEnd,main)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement