Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- data = turtle.inspect
- -- data.name is the block inspected, example, minecraft:chest
- fuelEmpty = 200
- canLoop = "random"
- function startUp()
- print("startUp")
- turtle.select(1)
- turtle.suckDown()
- turtle.refuel()
- turtle.dropDown()
- end
- function checkFuel()
- print("Checking Fuel")
- if turtle.getFuelLevel() < fuelEmpty then
- turtle.turnLeft()
- turtle.turnLeft()
- a = 1
- while a == 1 do
- inspect = turtle.inspectDown()
- if inspect == true then
- booldata, data = turtle.inspectDown()
- print(data.name)
- if data.name == "minecraft:chest" then
- turtle.turnLeft()
- turtle.turnLeft()
- for i = 1, 16 do
- turtle.select(i)
- turtle.dropDown()
- end
- a = 2
- return "x"
- else
- turtle.forward()
- end
- else
- turtle.forward()
- end
- end
- end
- end
- function miningSet()
- print("Mining Set")
- for i = 1, 3 do
- if turtle.detect() then
- repeat
- turtle.dig()
- local success, digdig = turtle.detect()
- until(success == false)
- end
- turtle.forward()
- turtle.digDown()
- end
- end
- function miningRight()
- print("Mining Right")
- turtle.turnRight()
- if turtle.detect() then
- for i = 1, 20 do
- if turtle.detect() then
- repeat
- turtle.dig()
- local success, digdig = turtle.detect()
- until(success == false)
- end
- turtle.forward()
- turtle.digDown()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- for i = 1, 20 do
- turtle.forward()
- end
- turtle.turnRight()
- else
- turtle.turnLeft()
- end
- end
- function miningLeft()
- print("Mining Left")
- turtle.turnLeft()
- if turtle.detect() then
- for i = 1, 20 do
- if turtle.detect() then
- repeat
- turtle.dig()
- local success, digdig = turtle.detect()
- until(success == false)
- end
- turtle.forward()
- turtle.digDown()
- end
- turtle.turnRight()
- turtle.turnRight()
- for i = 1, 20 do
- turtle.forward()
- end
- turtle.turnLeft()
- else
- turtle.turnRight()
- end
- end
- function checkInv()
- if turtle.getItemCount(16) > 0 then
- turtle.turnLeft()
- turtle.turnLeft()
- a = 1
- while a == 1 do
- inspect = turtle.inspectDown()
- if inspect == true then
- booldata, data = turtle.inspectDown()
- print(data.name)
- if data.name == "minecraft:chest" then
- turtle.turnLeft()
- turtle.turnLeft()
- for i = 1, 16 do
- turtle.select(i)
- turtle.dropDown()
- end
- a = 2
- return "x"
- else
- turtle.forward()
- end
- else
- turtle.forward()
- end
- end
- end
- end
- --[[
- function checkInv()
- print("Checking inventory")
- turtle.select(16)
- items = turtle.getItemCount
- if items == 0 then
- print("nice")
- else
- turtle.turnLeft()
- turtle.turnLeft()
- repeat
- while true do
- turtle.forward()
- if turtle.inspectDown() == true then
- booldata, data = turtle.inspectDown()
- return
- end
- if turtle.inspectDown() == false then
- turtle.forward()
- end
- end
- until(string.find(data.name, "minecraft:chest"))
- turtle.turnLeft()
- turtle.turnLeft()
- for i = 1, 16 do
- turtle.select(i)
- turtle.dropDown()
- x = 2
- return x
- end
- end
- end
- ]]--
- startUp()
- miningSet()
- while canLoop ~= "x" do
- miningLeft()
- miningRight()
- miningSet()
- canLoop = checkFuel()
- if canLoop ~= "x" then
- canLoop = checkInv()
- end
- end
- --[[function miningRight()
- turtle.turnRight()
- local success, canDig = turtle.detect()
- if success == true then
- for i = 1, 20 do
- repeat
- local success, canDig = turtle.detect()
- if success == true then
- turtle.dig()
- end
- until(canDig == false)
- turtle.forward()
- turtle.digDown()
- end
- end
- end]]--
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement