Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function askDimensions()
- print("length:")
- Length = tonumber(read())
- print("width:")
- Width = tonumber(read())
- print("height:")
- Height = tonumber(read())
- end
- local function fuel()
- turtle.select(15)
- if turtle.getItemDetail then
- local item = turtle.getItemDetail()
- while true do
- if item ~= nil and item.name == "minecraft:coal" or item.name == "minecraft:coal_block" then
- turtle.refuel()
- break
- else
- print("no coal or coal blocks in second to last slot!")
- sleep(5)
- end
- end
- else
- print("no coal or coal blocks in second to last slot!")
- sleep(5)
- end
- end
- local function checkFuel()
- while turtle.getFuelLevel() < Length * Height * Width * 5 do
- print("not enough fuel")
- sleep(2)
- fuel()
- end
- end
- local function checkForChests()
- -- checking if the turtle has a chest in the last slot
- turtle.select(16)
- while true do
- if turtle.getItemDetail() then
- local item = turtle.getItemDetail()
- while item.name ~= "minecraft:chest" or item.count < 64 do
- print("vanilla chest needed in last slot!")
- sleep(5)
- end
- break
- else
- print("vanilla chest needed in last slot!")
- sleep(5)
- end
- end
- end
- local function initialize()
- askDimensions()
- checkFuel()
- checkForChests()
- end
- local function chestDump()
- -- chest must be placed in 16th slot
- turtle.select(16)
- turtle.placeDown()
- for i = 1, 15, 1 do
- turtle.select(i)
- turtle.dropDown()
- end
- end
- local function checkForInventorySpace()
- local dumpNeeded = true
- for i = 1, 15, 1 do
- if dumpNeeded == false then
- break
- end
- turtle.select(i)
- if (turtle.getItemDetail()) then
- dumpNeeded = false
- end
- end
- if dumpNeeded then
- chestDump()
- end
- end
- local function digLayer()
- -- mine the whole area
- for z = 0, Width, 1 do
- for x = 0, Length, 1 do
- print("mining layer")
- end
- end
- end
- local function moveDownLayer()
- -- check block below, if not air, water or lava mine, move down
- print("going down one layer")
- end
- local function dig()
- for layer = 0, Height, 1 do
- digLayer()
- if layer < Height - 1 then
- moveDownLayer()
- end
- end
- end
- local function main()
- initialize()
- dig()
- print("done")
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement