Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- FTB AutomaticFarm - V 1.0
- -- Made by Xmarks
- -- https://www.youtube.com/channel/UCA6oAnFqdDcc0sa6H8G5DSA
- -- Program Farms and Replants Seeds
- -- TODO: Not getting blocked by Blocks or Entities
- -- TODO: Drop Excess to chest below Turtle
- -- *********************************
- -- Fuel Goes to Slot 1
- -- Seeds for comparison go to Slot 2
- -- *********************************
- x = 2
- y = 2
- seed_slot = 0
- local function CheckFuel()
- if turtle.getFuelLevel() < 20 then
- turtle.select(1)
- turtle.refuel(1)
- end
- end
- local function forward()
- CheckFuel()
- Counter = 0
- while Counter < 1 do
- if turtle.forward() then
- Counter = Counter + 1
- end
- end
- end
- local function GoLeft()
- turtle.turnLeft()
- forward()
- turtle.turnLeft()
- end
- local function GoRight()
- turtle.turnRight()
- forward()
- turtle.turnRight()
- end
- local function find_seeds()
- for i = 3,16 do
- turtle.select(i)
- if turtle.compareTo(2) then
- return i
- end
- end
- return 0
- end
- local function HarvestReplant()
- seed_slot = find_seeds()
- if seed_slot == 0 then
- turtle.select(2)
- else
- turtle.select(seed_slot)
- end
- turtle.digDown()
- turtle.placeDown()
- end
- local function Farm()
- for i =1,x do
- if i%2 == 1 then
- GoLeft()
- for j =1,y do
- HarvestReplant()
- if j ~= y then
- forward()
- end
- end
- elseif i%2 == 0 then
- GoRight()
- for j = 1,y do
- HarvestReplant()
- if j ~= y then
- forward()
- end
- end
- end
- end
- end
- local function ReturnHome()
- if x%2 == 0 then
- forward()
- turtle.turnRight()
- for i = 1,x do
- forward()
- end
- elseif x%2 == 1 then
- turtle.turnLeft()
- turtle.turnLeft()
- for j = 1,y do
- forward()
- end
- turtle.turnRight()
- for i = 1,x do
- forward()
- end
- end
- turtle.turnRight()
- forward()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- local function TimeOut()
- for i = 23100,0,-1 do
- print(i)
- sleep(1)
- end
- end
- while true do
- Farm()
- ReturnHome()
- TimeOut()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement