Advanced Vein Miner Program

Started by Qendolin, Sep 22, 2023, 09:38 PM

Previous topic - Next topic

Qendolin

Hi, this is my first post on this forum. I've developed a quite advanced vein miner program and wanted to share it. I used it to mine large amounts of Asurine, Crimsite and Veridium ore in the Create: Astral modpack.

Installation:
pastebin get 5MP0gt2R veinm.lua
https://pastebin.com/5MP0gt2R

Usage: veinm <pattern>... [options...]
Options:
 -help
 -junk <junk_pattern>...
 -safe <width> [height] [depth]
 -debug <filters>...

Specify at least one <pattern> to match against the block ids which should get mined.
The turtle will find and mine all connected blocks of these types.
Example: `veinm granite$ andesite$` will mine all blocks ending with "granite" and "andesite".

Specify zero or more <junk_pattern> to match against item ids in the turtle's inventory
  which will get tossed out when the turtle is full.
Example: `-junk stone$` will toss out any items ending with "stone" such as cobblestone.

Specify a safe zone which the turtle will not enter.
By default the safe zone extends infinitely behind the turtle starting position.
Any dimension that is not specified is assumed to be infinite.
Example: `-safe inf 11 10` will exclude an area behind the turtle that
  is `infinitely` wide, 5 blocks up, 5 blocks down and 10 blocks deep

All patterns use the lua pattern syntax: https://www.lua.org/pil/20.2.html

When the turtle cannot find any more blocks to mine it will return to its starting position.
It will also return to its starting position when it runs low on fuel.

Setup:
1. Place the turtle facing away from a chest. In this chest the turtle will deposit the collected items.
2. Make sure a block that you wish to mine is directly in front of the turtle.
3. Place enough coal in the first slot of the turtle to fill it 50%. I recommend Blocks of Coal.
4. Run `veinm`
5. Make sure to keep the turtle loaded!!




The program is optimized to never check positions which it has already checked. It also includes a simple heuristic to mine blocks with as few wasted steps as possible. It also tries to mine the blocks closest to the origin first. There is also no issue with gravel.

Please keep in mind that the program is not resumable and will break when the turtle is unloaded. The program will also break if the vein you intend to mine is extends more than 1024 blocks in one direction. If you have to reset the turtle manually just place a path of blocks to lead the turtle to where it left of.
If you ever want to change the fuel item, just edit the "FuelItem" variable near the top of the script.

ModItAllMC

Nice To See People Using ComputerCraft With Create!