Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Farming
- local currentW = 1
- local currentD = 1
- width = 9
- depth = 9
- lr = 0
- function getWheat()
- local success, data = turtle.inspectDown()
- if success then
- if data.name == "minecraft:wheat" then
- if data.metadata == 7 then
- turtle.digDown()
- end
- end
- end
- end
- function seed()
- local existS = turtle.detectDown()
- if existS == false then
- -- turtle.down(1)
- -- turtle.up(1)
- turtle.digDown()
- existSeedslot = 0
- for i = 1 , 16 do
- turtle.select(i)
- local data = turtle.getItemDetail(i)
- if data ~= nill and data.name == "minecraft:wheat_seeds" then
- existSeedslot = i
- i = 16
- end
- data = 0
- end
- if existSeedslot ~= 0 then
- turtle.select(existSeedslot)
- turtle.placeDown()
- end
- end
- end
- function back()
- for i = 2 , width do
- turtle.back()
- end
- if lr == 1 then
- turtle.turnLeft()
- for i = 2 , depth do
- turtle.back()
- end
- end
- end
- getWheat()
- seed()
- local loop = 1
- while loop == 1 do
- currentD = 1
- while currentD < depth do
- turtle.forward(1)
- getWheat()
- seed()
- currentD = currentD + 1
- end
- if lr == 0 then
- turtle.turnRight()
- lr = 1
- else
- turtle.turnLeft()
- lr = 0
- end
- if currentW < width then
- turtle.forward()
- currentW = currentW + 1
- if lr == 0 then
- turtle.turnLeft()
- else
- turtle.turnRight()
- end
- getWheat()
- seed()
- else
- back()
- currentW = 1
- getWheat()
- seed()
- lr = 0
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement