Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[aWheatFarm]]--
- --[[By: ThePhoenixSol]]--
- --[[Version 2.0]]--
- --[[Slot Designation]]--
- --# Slot 1 is seeds
- --# Slot 5-7 is wheat
- --# Slot 2 is fuel
- --[[VARIABLES]]--
- local cycle = true
- local cyc = 6
- local cycTwo = 4
- local cycThree = 2
- local incNum = 0
- --[[FUNCTIONS]]--
- function refueling()
- term.clear()
- term.setCursorPos(1, 1)
- print("=======================================")
- print("Warning: Out of Fuel... Refueling")
- print("=======================================")
- end
- function crafting()
- term.clear()
- term.setCursorPos(1, 1)
- print("=======================================")
- print("Crafting...")
- print("=======================================")
- end
- function running()
- term.clear()
- term.setCursorPos(1, 1)
- print("=======================================")
- print("Running...")
- print("=======================================")
- end
- function wait()
- term.clear()
- term.setCursorPos(1, 1)
- print("=======================================")
- print("Waiting...")
- print("=======================================")
- os.sleep(120)
- end
- function refuel()
- local fuelLevel = turtle.getFuelLevel()
- if fuelLevel < 300 then
- refueling()
- turtle.turnRight()
- turtle.select(2)
- turtle.suck()
- turtle.refuel()
- turtle.turnLeft()
- end
- end
- function InvEmp()
- for i = 1, 4 do
- turtle.select(i)
- turtle.dropDown()
- end
- for i = 8, 16 do
- turtle.select(i)
- turtle.dropDown()
- end
- turtle.select(8)
- turtle.dropDown()
- end
- function craft()
- crafting()
- turtle.turnLeft()
- turtle.select(1)
- turtle.drop()
- turtle.select(2)
- turtle.drop()
- InvEmp()
- turtle.select(16)
- turtle.craft()
- turtle.dropDown()
- turtle.select(1)
- turtle.suck()
- turtle.select(2)
- turtle.suck()
- turtle.turnRight()
- end
- function fetchSeed()
- for i = 1, 16 do
- local data = turtle.getItemDetail(i)
- local seedAmt = turtle.getItemCount(1)
- if data and data.name == "minecraft:wheat_seeds" then
- turtle.select(i)
- if seedAmt < 60 then
- turtle.transferTo(1)
- else
- turtle.dropDown(30)
- end
- end
- end
- end
- function replant()
- fetchSeed()
- turtle.select(1)
- turtle.placeDown()
- end
- function harvest()
- local success, data = turtle.inspectDown()
- if success and data.name == "minecraft:wheat" and data.metadata == 7 then
- for i = 5, 7 do
- if turtle.getItemCount(i) < 64 then
- turtle.select(i)
- turtle.digDown()
- replant()
- return
- end
- end
- end
- end
- function forwFarm()
- turtle.forward()
- harvest()
- end
- function rightForwLayOne()
- turtle.turnRight()
- while cyc > incNum do
- forwFarm()
- incNum = incNum + 1
- end
- incNum = 0
- end
- function rightForwLayTwo()
- turtle.turnRight()
- while cycTwo > incNum do
- forwFarm()
- incNum = incNum + 1
- end
- incNum = 0
- end
- function rightForwLayThree()
- turtle.turnRight()
- while cycThree > incNum do
- forwFarm()
- incNum = incNum + 1
- end
- incNum = 0
- end
- function returnHome()
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.down()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function status()
- running()
- turtle.up()
- forwFarm()
- turtle.turnLeft()
- forwFarm()
- forwFarm()
- forwFarm()
- rightForwLayOne()
- rightForwLayOne()
- rightForwLayOne()
- turtle.turnRight()
- forwFarm()
- forwFarm()
- forwFarm()
- turtle.turnRight()
- forwFarm()
- turtle.turnLeft()
- forwFarm()
- forwFarm()
- rightForwLayTwo()
- rightForwLayTwo()
- rightForwLayTwo()
- turtle.turnRight()
- forwFarm()
- forwFarm()
- turtle.turnRight()
- forwFarm()
- turtle.turnLeft()
- forwFarm()
- rightForwLayThree()
- rightForwLayThree()
- rightForwLayThree()
- returnHome()
- end
- --[[MAIN]]--
- while cycle do
- refuel()
- status()
- craft()
- wait()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement