Jump to content




Advanced Branch Mining Turtle (with Self-Setup!)

turtle lua utility

13 replies to this topic

#1 ReconTurtle

  • Members
  • 26 posts

Posted 07 July 2014 - 04:46 PM

Note: I rewrote this page so it's not as awful to read. Check this out. You may actually get past the first paragraph now.

[email protected] Summary
(Am I allowed to swear?)

This pair of programs is designed to do the hard work of branch mining for you: setting it up and digging the shafts. The first of the two programs, "Setup", digs a staircase down to the designated mining level, placing torches incrementally along the way. Once it digs down far enough, it clears out a base room and sets up a double-chest as well as a Redstone Signalling System* to tell you with a glance when something is amiss with the program.

Once that is complete, just launch the "Mine" program, input the number of branches you'd like the turtle to dig, add some more fuel and torches if needed, and then sit back and relax while the turtle goes on a spree of organized block destruction. When the turtle is running low on fuel or torches, it will drop by the chest and give you a friendly note so you can add some more. Once the turtle has completed it's job, it will return to its starting point and turn off the redstone torch on the left of the chest to signify its accomplishment.

From there, you get to do the fun part of the job: just jaunt around the pre-excavated mine shafts and release the ores from their stony prisons while you laugh with merriment. Both these programs are designed to "bridge" over any missing gaps in the underground environment, attempting to give you the more pleasurable mining experience possible. (Do note that this cannot yet deal with liquids. That's some hard sh*t for a turtle to deal with.)

So what on earth are you waiting for? Download this using the commands below and give it a whirl! Please let me know of any bugs or issues you run into.

* This is only mostly working right now.

Plans for Future Features
> Recursive functions that while, get this, dig out the ore for you! Then you don't have to do anything at all!!
> Improved redstone signalling system
> 3-high staircase dug in "Setup". (This has a number of issues, and I am looking into how to code this efficiently.)
> Ability to 'clean-up' after you've mined everything out.
- This would both collect all the torches and wall off the mine shafts to prevent zombies from wandering into other mines that may be connected to the main base room.
> Ability to craft more torches as it goes along. (This is the main issue right now; the program runs through a ton of torches.)
> Add "bridging" ability to clearing the main room.

Here is a diagram of how the turtle mines:
Posted Image

Instructions Shmeductions

Downloading the Programs
First things first, you need to get a copy of these bad boys onto your Mining Turtle. (Crafty and/or Wireless is optional/unused. Batteries not included.) Run the following commands in the turtle command interface:

pastebin get SZLnGvCu Mine
pastebin get xAx3KmZs Setup

From there, you are ready to go! See the instructions below for further help with each of the programs. If you are feeling particularly confident, or perhaps just a bit feisty, see if you can't get it up and running just using the on-screen instructions. (It would also be good for me to know if some clarification is needed, but this is mostly about your feisty-ness.)

Setup
Run the program by typing "Setup" in your terminal (without the quote. C'mon man.) From there, you need to fill slot 16 with a butt-load of torches, (I just realized how disgusting of a term that really isl, and we were saying that in elementary school!), slot 15 with two chests, and slot 14 with a single redstone torch. Then you must take heed of your current Y-coordinate. Locate that using <F3> or Rei's Minimap, if you're using Tekkit like me, then input that into the program. Next, designate your desired mining level. I recommend level 11 or 12, I personally do the latter. But hey, it's your turtle, and your copy of the program, do whatever the hell you want, I DON'T CARE. (I kind of do.) Then fuel up with whatever you got. It will use any fuel left over from this program when mining, as long as you don't break the turtle in between. (Don't do it, you dolt.) After that, you're off! Or rather, the turtle's off. But it was you who went through the arduous task of telling it where to go, so congratulations! You're clearly the real hero here.

Mine
After the turtle has finished doing it's job with "Setup" it's time to get down to (the real) business. From here, launch "Mine" by typing that into your terminal. (If you type in the quotes again, I swear to God I'mma slap you upside the head.) From here all you need to do is type in how many branches you want the turtle to mine. I usually do 20, but keep in mind that that takes multiple loads of torches, around 4000 fuel, and you need to either follow it around or use some sort of chunk loader, or the turtle with just stop. Like, it will throw down it's pickaxe, flip you the bird, exit the mine, and just fly towards the sun for the rest of eternity. And don't expect any postcards from the far lands. They don't have postage there. After you designate your distance, it's time to fuel up again. This time, it will calculate the raw cost in coal and lava buckets, that way you aren't just looking at a seemingly pointless fuel count number. Choose to refuel or, if you're feeling ballsy, just let it run. It will come begging for more fuel when it's running low. They always do. (No seriously, they always do. I programmed it that way.) Same with torches.
The rest is self-explanatory. Just sit back, relax, and all the other stuff I said up there.

Edited by ReconTurtle, 09 July 2014 - 06:11 PM.


#2 recon

  • New Members
  • 1 posts

Posted 13 July 2014 - 10:42 AM

Awesome script, works great! But why would you leave 3 blocks between branches?
Could you lower that to 2 blocks so you get all ores and don't miss one row?
Posted Image

#3 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,451 posts

Posted 13 July 2014 - 03:22 PM

Sure, you could, but it's less efficient. The amount of times you'd miss a single solitary piece of ore between shafts is vastly outweighed by the increased area covered with a given number of shafts. In fact, I've seen it mentioned that five or six blocks between is even more efficient.

#4 ReconTurtle

  • Members
  • 26 posts

Posted 13 July 2014 - 10:52 PM

As Lydyd stated above, 3 is simply more efficient. It can be argued that there are a lot of single-double block veins in Tekkit, but I find it's simply trivial and wasteful of fuel to go any less than 3 between. Thanks for the input though!

#5 hilburn

  • Members
  • 153 posts
  • LocationLondon, England

Posted 14 July 2014 - 01:47 AM

Just a thought, but if you wanted to increase fuel efficiency further, you could have it alternate between a branch heading out from the central shaft to a branch heading back in.
It prevents the turtle doubling back on itself and going through regions it has already dug out

#6 BTNGaming

  • Members
  • 7 posts
  • LocationWashington, USA

Posted 18 July 2014 - 07:26 PM

This is a really cool setup, I'll be sure to test it out tonight if I get CC working on my 1.7.2 setup. =]

So I tested this out a bit...

Every time I tried to get it running, I ran Setup as instructed above. I'm on y 10 and wanted to end at y 12. Perfectly fine. When it starts to setup though, it just spins in circles, drops a chest in front of itself then spits out everything behind it and says ready.

After that I tried running Mine as instructed above thinking maybe it would fix itself. It just spins in circles, places a torch above it's head, breaks the torch and does it over again.

Yes, I placed all of the materials in the proper item slot numbers (RS Torch in 14, 2 chests in 15 and Torches in 16) I fueled it up etc etc.

Any idea why it would do this?


(For some reason it was not accepting the fuel that was in slot 1 during setup for REFUELING stage, and in the MINE stage I said no or yes, it didn't matter it ignored it.) I restarted MC and tried again and it worked...

Edited by BTNGaming, 19 July 2014 - 03:19 AM.


#7 ReconTurtle

  • Members
  • 26 posts

Posted 20 July 2014 - 08:13 PM

I'm sorry, I'm confused by your problem. From what you first describe, it's clear that the turtle wasn't fueled at all. When it comes to you being on Y=10 and wanting it to setup at Y=12, the turtle is designed to dig from ground level, meaning something around Y=70. If you are already down in the mineshaft, there's no reason to run the setup command, you just need to place two chests down one space away from the wall, and then place the turtle in between the double chest and the wall.

The only problem here would be no fuel. If you fueled up, then I'm really not sure what's going on. What fuel are you using, and how much of it?

The last comment you made seemed to be a quick edit, but I still cannot tell if you got it working or not.

#8 Danny12328

  • Members
  • 7 posts

Posted 20 July 2014 - 10:14 PM

I used this and the turtle after making the first two shafts, came and emptied into the chest and then gave this error.
mine:145: attempt to compare number with string expected, got number


#9 Demosthenex

  • Members
  • 7 posts

Posted 22 July 2014 - 08:09 PM

I like the branch layout! I had considered trying to make a branch miner like this because that is how I mine manually, but instead I settled on the Hilbert curve miner because in terms of efficiency I think it beats branches.

Now I may have to go patch it to compensate for gravel though.

Great diagrams too!

#10 ReconTurtle

  • Members
  • 26 posts

Posted 23 July 2014 - 09:37 PM

View PostDanny12328, on 20 July 2014 - 10:14 PM, said:

I used this and the turtle after making the first two shafts, came and emptied into the chest and then gave this error.
mine:145: attempt to compare number with string expected, got number

Thanks for letting me know about this bug. I'm still looking into what is triggering this error, but you providing the error message really helps.
All I know so far is that this is triggered when the turtle is running low on fuel, so I recommend stocking it up with as much as you can afford (without going overboard) before starting the mining process. That should prevent this from happening for now until I get the bug 100% patched.

Edited by ReconTurtle, 23 July 2014 - 09:39 PM.


#11 KatanaKid

  • Members
  • 5 posts

Posted 24 July 2014 - 01:13 AM

I love how much personality you put into this post xD

#12 Alduin

  • New Members
  • 1 posts

Posted 16 August 2014 - 10:03 PM

Man deserves a medial for this code :D

#13 renjestoo

  • Members
  • 46 posts

Posted 15 August 2019 - 01:01 PM

The code doesn't seem to work anymore in 2019!
I use it now in Minecraft 1.14.4 in combination with cc-tweaked-1.14.4-1.84.0

the setup works perfectly fine... but the branchmining?... MAN!!... it only digs up and up and up and up... sometimes it shifts itself 1 block to the right and then there is rinse and repeat... only going up and up and up...

could someone help me?
Or is it just that the code is too old?

Edited by renjestoo, 15 August 2019 - 01:01 PM.


#14 Nicolay

  • Members
  • 11 posts

Posted 24 August 2019 - 04:44 PM

View Postrenjestoo, on 15 August 2019 - 01:01 PM, said:

The code doesn't seem to work anymore in 2019!
I use it now in Minecraft 1.14.4 in combination with cc-tweaked-1.14.4-1.84.0

the setup works perfectly fine... but the branchmining?... MAN!!... it only digs up and up and up and up... sometimes it shifts itself 1 block to the right and then there is rinse and repeat... only going up and up and up...

could someone help me?
Or is it just that the code is too old?

Having the same problem....





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users