Turtle mynwell (Strip Mining)

  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

Truthowl

New Member
Jul 29, 2019
15
0
0
I named the program mynwell. It's based on the setup direwolf20 did in his LP season 5 series. But I never have liked frames or overly complicated builds. Took me a little bit to figure out a way to do it but it now works and works fabulously. This mynwell will mine from whatever level you choose to start it at and mines to bedrock in just a handful of seconds. Then it retrieves it's equipment and moves forward, deploys the equipment and bam, your at bedrock again. It'll keep doing this for the 'length you choose. Then it'll mine back towards you, left or right, from the original straight forward path, also ming, if you've told it to mine, say, 500 length and 500 width. Additionally it will stop after using about 960 fuel to allow you to change out the Thermal Expansion Energy Cell with a freshly charged one. I included pastebin codes for each of the programs each turtle will need to function. Here's what you'll need to make it work.

1. Mining turtle (labeled)
2. Engineering turtle (labeled)
3. Ender Chest
4. Mining Well
5. Thermal Expansion Energy Cell (fully charged)

Once you have each of the turtle's retrieve each program it needs, simply run mynwell in the mining turtle and follow the instructions. I like to make a mystcraft age and mine about 5 blocks down and then release this. Some of the mystcraft ages negative affects only bother you if your exposed to the sky so by mining underground you get lots of goodies. This thing mines really fast.

If there's a problem let me know and I'll try to fix it. I made this for myself and it works flawlessly... mostly anyway... I was having issues with multi-levels of gravel but I think I got that kink worked out okay. The one thing I cant do anything about is if you shut the game/server down the turtles stop and need to be restarted. I hope someone likes this as much as I do. I am backing up my Ultimate ftb folder because I think sooner or later some mod author will nerf something to make this not work. Let me know what you think.

The code below is pastebin codes for easier retrieval of each script/program.
Code:
-- Author: Truthowl
-- Makes turtle use a mining well and redstone energy cell to mine.
-- Requires an Engineering Turtle, Mining Turtle, Ender Chest,
-- Mining well, and a Thermal Expansion Energy Cell.
-- The Engineering Turtle was crafted with a Thermal Expansion Hammer.
-- Not sure if crafting with something else will work or not.
--
-- I made my mining turtle a chunk loading turtle as well.
-- That's not needed, but then you have to remain close or drop
-- your own chunk loader if you want to leave the area.
-- With this, you can even set your mynwell turtle to begin underground.
-- He/she will clear the workzone before placing the needed equipment.
-- Also, the turtle will backup 1 block to begin mining from
-- where you place him/her. So drop it from 2 blocks back or drop it
-- and move out of the way.
-- NOTE: Do not shut down your game while your mynwell turtle is running
-- They will stop and need to be restarted if you do.
--
-- You need to label both the mining and engineering turtles. I know,
-- that's obvious but thought I'd mention it anyway.
-- The code below is pastebin codes for easier retrieval of each script/program.
-- Okay the turtle's need the following programs.
--
-- Engineering Turtle --
-- myfuel - 6FJH87dt
-- collectit - GYCsY7rr
-- startup - TpZs1Mqm
-- ---------------------
-- Mining Turtle --
-- mynwell - xUtqQ73B(This program)
-- myfuel - 6FJH87dt
-- ---------------------
-- If you choose not to use the 'myfuel' program then you need to
-- comment it out from the programs. It simply reports remaining fuel.
-- However, you need both the startup and collectit programs for
-- the engineering turtle.
 
function instructions()
    print("Place a Redstone Energy Cell in slot 1")
    print("Place an ender chest in slot 2")
    print("Place a Mining well in slot 3")
    print("Place an Engineering turtle in slot 4")
end
 
function getDim()
    print("Current fuel level = " .. turtle.getFuelLevel())
    print("How far should I mine before returning?")
    l = tonumber(read())
    print("How wide should my mining be?")
    w = tonumber(read())
    term.write("Left(1) or Right(2)?")
    mydir = read()
    return {l, w, mydir}
end
 
function clearWorkZone()
    while turtle.detect() do
        turtle.dig()
        sleep(0.5)
    end
    while not turtle.up() do
        turtle.digUp()
    end
    while turtle.detect() do
        turtle.dig()
        sleep(0.5)
    end
end
 
function forward()
        while not turtle.forward() do
            turtle.dig()
            turtle.suck()
            turtle.attack()
            turtle.suck()
            sleep(0.5)
        end
end
 
function deploy()
    while turtle.getItemCount(1) ~= 0 do
        turtle.select(1)
        turtle.place()
    end
    turtle.down()
    while turtle.getItemCount(2) ~= 0 do
        turtle.select(2)
        turtle.placeUp()
    end
    while turtle.getItemCount(4) ~= 0 do
        turtle.select(4)
        turtle.transferTo(16)
    end
    while turtle.getItemCount(3) ~= 0 do
        turtle.select(3)
        while not turtle.place() do
            turtle.dig()
            sleep(0.5)
        end
    end
    sleep(0.5)
end
 
function retrieve()
    if turtle.getItemCount(1) > 0 then
        print("Error, sleeping for 10,000")
        sleeping(10000)
    end
    while turtle.getItemCount(2) == 0 do
        turtle.select(1)
        turtle.digUp()
        turtle.transferTo(2)
    end
    while turtle.getItemCount(3) == 0 do
        turtle.select(1)
        turtle.dig()
        turtle.transferTo(3)
    end
    while turtle.getItemCount(16) ~= 0 do
        turtle.select(16)
        turtle.place()
    end
    local engineer = peripheral.wrap("front")
    while turtle.getItemCount(1) == 0 do
        engineer.turnOn()
        turtle.select(1)
        while not turtle.suck() do
            sleep(3)
        end
    end
    while turtle.dig() == false do
        sleep(0.1)
    end
end
 
function scanMe()
    turtle.select(1)
    for i=1, 15 do
        if turtle.getItemCount(i) > 0 then
            return false
        end
    end
    return true
end
 
function unload()
    turtle.select(1)
    while scanMe() == false do
        for i=1,15 do
            turtle.select(i)
            if turtle.getItemCount(i) > 0 then
                if turtle.getFuelLevel() < 1000 then
                    turtle.refuel()
                end
                turtle.dropUp()
                sleep(0.1)
            end
        end
    end
end
 
function mineLength(l)
    for i=1, l do
        clearWorkZone()
        deploy()
        sleep(6)
        unload()
        retrieve()
        forward()
    end
    print("I have this much fuel left")
    print(tostring(turtle.getFuelLevel()))
end
 
function turn(d,x)
    if d == "1" then
        turtle.turnLeft()
        clearWorkZone()
        deploy()
        sleep(6)
        unload()
        retrieve()
        forward()
        turtle.turnLeft()
    elseif d == "2" then
        turtle.turnRight()
        clearWorkZone()
        deploy()
        sleep(6)
        unload()
        retrieve()
        forward()
        turtle.turnRight()     
    else
        print("You were supposed to type a direction(1/2).")
        print ("But you typed " .. d .. " instead")
    end
    x = x + 1
    return x
end
 
-- Main
local myt
-- x = starting point by width
local x = 1
 
instructions()
myt = getDim()
local ll = tonumber(myt[1])
local ww = tonumber(myt[2])
local dd = myt[3]
local bb --this will be opposite dd
local recharge = turtle.getFuelLevel() - 960
print ("Length will be = " .. ll)
print ("Width will be =    " .. ww)
 
if dd == "1" then
    bb = "2"
elseif    dd == "2" then
    bb = "1"
else
    print("You were supposed to type a direction(1/2).")
    print ("But you typed " .. dd .. " instead")
end
 
while not turtle.back() do
    sleep(1)
end
mineLength(1)
 
if ww > x then
    while x <= ww do
        if turtle.getFuelLevel() <= recharge then
            print("Waiting so you can change out the energy block")
            waiting = read()
            recharge = turtle.getFuelLevel() - 960
        end
        mineLength(ll)
        if x == ww then
            --print("Odd exit")
            shell.run("myfuel")
            return
        else
            x = turn(dd,x)     
        end
        mineLength(ll)
        if x >= ww then
            --print("Even exit")
            shell.run("myfuel")
            return
        else
            x = turn(bb,x)     
        end
    end
else
    mineLength(ll)
end
 
print ("All Finished!")
shell.run("myfuel")
 
  • Like
Reactions: QueWhat and egor66

Truthowl

New Member
Jul 29, 2019
15
0
0
uhhh, forgot to mention that I set my Thermal Expansion Energy Cell's output to 10 to get the most mining for energy input so far. It's still really fast and I can do about a 20x20 quarry with 1 full charge like that.
 

egor66

New Member
Jul 29, 2019
1,235
0
0
First off nice work & share, second I was looking at the code this is for 1.4.7 I take it, as cc has changes a little you may need to edit for 1.5+ some api handlers n stuff, again nice work.
 

Truthowl

New Member
Jul 29, 2019
15
0
0
Yes, this is for MC 1.4.7. I don't play anything newer. Not until FTB has it in either DW20's mod pack or Ultimate. But when that happens I can make any needed changes... Of course, that's IF something doesn't get nerfed. I also use a prospecting app for my early game to find initial ore's and diamonds. But I'm pretty sure there are other similar mining app's available. But I had not seen anything like this so thought my fellow FTBians might like this as a some what mid-game script to help with resource gathering.
 

Truthowl

New Member
Jul 29, 2019
15
0
0
Sorry, I probably should have added in that those are pastebin codes under Engineering Turtle and Mining Turtle in the code listing. I edited it and added the info just in case.