Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- blockState1Name = "BetterBuildings:BlockConcreteMix"
- blockState2Name = "BetterBuildings:BlockWetConcrete"
- blockState3Name = "BetterBuildings:BlockConcrete"
- function makeOrFarm()
- term.clear()
- term.setCursorPos(1,1)
- print("Press Enter To Make The Concrete Farm, Press RShift To Start/Resume Farming, Press H For How To Use/Help, Or Press Backspace To Cancel")
- while true do
- local event, key = os.pullEvent( "key" ) -- limit os.pullEvent to the 'key' event
- if key == keys.enter then -- if the key pressed was 'enter'
- makeFarm()
- break
- end
- if key == keys.rightShift then -- if the key pressed was 'rightShift'
- farm()
- break
- end
- if key == keys.h then -- if the key pressed was 'h'
- term.clear()
- term.setCursorPos(1,1)
- helpPageOne()
- break
- end
- if key == keys.backspace then -- if the key pressed was 'backspace'
- break
- end
- end
- end
- function helpPageOne() -- Displays basic help information to the screen
- print("---------------------------------------")
- print("What Items Go In The Turtle, And Where?")
- print("---------------------------------------")
- print("Slot 1: Fuel Source (DON'T USE LAVA!)")
- print("Slots 2-5: Concrete Mix")
- print("Slots 6-9: Concrete will go here don't put anything here")
- print("")
- print("Press -> For Next Page, Or Backspace To Exit")
- while true do
- local event, key = os.pullEvent( "key" ) -- limit os.pullEvent to the 'key' event
- if key == keys.right then -- if the key pressed was '->'
- term.clear()
- term.setCursorPos(1,1)
- helpPageTwo()
- break
- end
- if key == keys.backspace then -- if the key pressed was 'backspace'
- term.clear()
- term.setCursorPos(1,1)
- makeOrFarm()
- break
- end
- end
- end
- function helpPageTwo()
- print("For Building The Farm You Need The Following Items Plus The Previous Page")
- print("Slot 14: 1 Water Bucket")
- print("Slot 15: 1 Water Bucket")
- print("Slot 16: 4 Chests (Modded Chests Also Work)")
- print("")
- print("Press -> For Next Page, Or Backspace To Exit")
- while true do
- local event, key = os.pullEvent( "key" ) -- limit os.pullEvent to the 'key' event
- if key == keys.right then -- if the key pressed was '->'
- term.clear()
- term.setCursorPos(1,1)
- helpPageThree()
- break
- end
- if key == keys.backspace then -- if the key pressed was 'backspace'
- term.clear()
- term.setCursorPos(1,1)
- makeOrFarm()
- break
- end
- end
- end
- function helpPageThree()
- print("------------------------")
- print("What Goes In What Chest?")
- print("------------------------")
- print("Chests Are Numbered From Left To Right Looking At The Backs Of The Chests.")
- print("Chest 1: Concrete (Deposit Chest)")
- print("Chest 2: Concrete Mix (Withdraw)")
- print("Chest 3: Coal (Withdraw Chest)")
- print("")
- print("Press Backspace To Exit")
- while true do
- local event, key = os.pullEvent( "key" ) -- limit os.pullEvent to the 'key' event
- if key == keys.backspace then -- if the key pressed was 'backspace'
- term.clear()
- term.setCursorPos(1,1)
- makeOrFarm()
- break
- end
- end
- end
- function makeFarm()
- if turtle.getFuelLevel() < 800 then
- refuel(800)
- end
- forward(1)
- turtle.select(10)
- turtle.digDown()
- digArea(16)
- turtle.turnLeft()
- forward(7)
- turtle.turnLeft()
- forward(7)
- turtle.select(14) -- select the 1st water bucket
- turtle.placeDown() -- place the water bucket down
- forward(1)
- turtle.turnRight()
- forward(1)
- turtle.select(15) -- select the 2nd water bucket
- turtle.placeDown() -- place the water bucket down
- turtle.placeDown() -- grabs the water for the 1st bucket
- os.sleep(3) -- give the water time to refill
- turtle.select(14)
- turtle.placeDown() -- grabs the water for the 2nd bucket
- forward(7)
- turtle.turnLeft()
- forward(7)
- turtle.select(14)
- turtle.placeDown()
- turtle.turnLeft()
- forward(15)
- turtle.select(15)
- turtle.placeDown()
- turtle.turnLeft()
- forward(7)
- turtle.turnLeft()
- forward(7)
- turtle.select(14)
- turtle.placeDown()
- turtle.select(15)
- turtle.placeDown()
- turtle.turnRight()
- forward(1)
- turtle.turnRight()
- forward(7)
- turtle.turnLeft()
- forward(7)
- turtle.select(14)
- turtle.placeDown()
- turtle.turnLeft()
- forward(15)
- turtle.select(15)
- turtle.placeDown()
- turtle.turnRight()
- forward(2)
- turtle.select(16) -- selects the chests
- turtle.place() -- places a large chest for coal
- turtle.back()
- turtle.place()
- turtle.turnRight()
- forward(2)
- turtle.turnLeft()
- forward(1)
- turtle.place() -- places the next large chest for concrete mix
- turtle.back()
- turtle.place()
- turtle.turnRight()
- forward(2)
- turtle.turnLeft()
- forward(1)
- turtle.place() -- places the next large chest for concrete
- turtle.back()
- turtle.place()
- turtle.turnLeft()
- forward(4) -- returns to home
- turtle.turnLeft()
- for s=10, 16 do -- clear all building materials from inventory
- turtle.select(s)
- turtle.drop()
- end
- farm()
- end
- function farm()
- local success, data = turtle.inspect()
- if turtle.getFuelLevel() < 800 then
- refuel(800)
- end
- if success == true then
- if data.name == BlockState1Name then
- harvestConcrete()
- else
- waitToDry()
- end
- else
- placeConcreteMix()
- end
- end
- function placeConcreteMix()
- turtle.select(1)
- if turtle.getItemSpace(1) >= 0 then -- take fuel from the chest
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.suck(turtle.getItemSpace(1))
- turtle.turnRight()
- turtle.turnRight()
- end
- if turtle.getFuelLevel() < 800 then -- refuel with that fuel
- refuel(800)
- end
- if turtle.getItemSpace(1) >= 0 then -- get more fuel from the chest
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.suck(turtle.getItemSpace(1))
- turtle.turnRight()
- turtle.turnRight()
- end
- turtle.turnLeft()
- forward(2)
- turtle.turnLeft()
- for s=2, 5 do -- get concrete mix from the chest
- turtle.select(s)
- turtle.suck(turtle.getItemSpace(s))
- end
- turtle.turnLeft()
- forward(2)
- turtle.turnLeft()
- turtle.up()
- forward(1)
- turtle.select(2)
- placeTwoLines()
- placeTwoLines()
- turtle.select(3)
- placeTwoLines()
- placeTwoLines()
- turtle.select(4)
- placeTwoLines()
- placeTwoLines()
- turtle.select(5)
- placeTwoLines()
- placeTwoLines()
- turtle.turnLeft()
- turtle.turnLeft()
- forward(1)
- turtle.down()
- turtle.turnLeft()
- forward(16)
- turtle.turnLeft()
- waitToDry()
- end
- function placeTwoLines()
- for p=1, 15 do
- turtle.placeDown()
- forward(1)
- end
- turtle.placeDown()
- turtle.turnLeft()
- forward(1)
- turtle.turnLeft()
- for p=1, 15 do
- turtle.placeDown()
- forward(1)
- end
- turtle.placeDown()
- turtle.turnRight()
- forward(1)
- turtle.turnRight()
- end
- function isBlockDry()
- local success, data = turtle.inspect()
- if success then
- if data.name == blockState3Name then
- return true
- else
- return false
- end
- end
- return false
- end
- function waitToDry()
- while isBlockDry() == false do
- os.sleep(30)
- end
- harvestConcrete()
- end
- function harvestConcrete()
- turtle.select(6)
- for l=1, 16 do
- turtle.dig()
- forward(1)
- end
- turtle.turnLeft()
- turtle.dig()
- forward(1)
- turtle.turnLeft()
- for l=1, 15 do
- turtle.dig()
- forward(1)
- end
- turtle.turnRight()
- turtle.dig()
- forward(1)
- turtle.turnRight()
- for l=1, 15 do
- turtle.dig()
- forward(1)
- end
- turtle.turnLeft()
- turtle.dig()
- forward(1)
- turtle.turnLeft()
- for l=1, 15 do
- turtle.dig()
- forward(1)
- end
- turtle.select(7)
- turtle.turnRight()
- turtle.dig()
- forward(1)
- turtle.turnRight()
- harvestSection()
- turtle.select(8)
- turtle.turnRight()
- turtle.dig()
- forward(1)
- turtle.turnRight()
- harvestSection()
- turtle.select(9)
- turtle.turnRight()
- turtle.dig()
- forward(1)
- turtle.turnRight()
- harvestSection()
- forward(1)
- turtle.turnLeft() -- head back to home
- forward(11)
- turtle.turnRight()
- for s=6, 9 do -- deposit all concrete
- turtle.select(s)
- turtle.drop()
- end
- turtle.turnLeft()
- forward(4)
- turtle.turnLeft()
- farm()
- end
- function harvestSection()
- for l=1, 15 do
- turtle.dig()
- forward(1)
- end
- turtle.turnLeft()
- turtle.dig()
- forward(1)
- turtle.turnLeft()
- for l=1, 15 do
- turtle.dig()
- forward(1)
- end
- turtle.turnRight()
- turtle.dig()
- forward(1)
- turtle.turnRight()
- for l=1, 15 do
- turtle.dig()
- forward(1)
- end
- turtle.turnLeft()
- turtle.dig()
- forward(1)
- turtle.turnLeft()
- for l=1, 15 do
- turtle.dig()
- forward(1)
- end
- end
- function digLine(l)
- for d=1, l do
- turtle.dig()
- forward(1)
- turtle.digDown()
- turtle.drop()
- end
- end
- function digArea(a)
- for f=1, a do
- digLine(a-1)
- if f == a then
- return
- elseif f % 2 == 1 then
- turtle.turnLeft()
- digLine(1)
- turtle.turnLeft()
- elseif f % 2 == 0 then
- turtle.turnRight()
- digLine(1)
- turtle.turnRight()
- end
- end
- end
- function forward(l)
- for i=1, l do
- for f=1, 3 do
- if turtle.forward() == false then
- if turtle.getFuelLevel() <= 0 then
- refuel(300)
- else
- turtle.dig()
- turtle.attack()
- term.clear()
- term.setCursorPos(1,1)
- print("Unable to move forward... Is something in the way?")
- end
- else
- break
- end
- end
- end
- end
- function refuel(l)
- turtle.select(1)
- while turtle.getFuelLevel() < l do
- if turtle.getItemCount(1) > 0 then
- turtle.refuel(1)
- else
- term.clear()
- term.setCursorPos(1,1)
- print("Please insert more fuel into slot 1...")
- os.sleep(10)
- end
- end
- end
- makeOrFarm()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement