←  Turtle Programs

ComputerCraft | Programmable Computers for Minecraft

»

More turtle mining (early and later game m...

Robert1707's Photo Robert1707 18 Jul 2015

Mine Turtle Instructions


The turtles have been programmed so that they will automatically refuel and gather torches which it places so as to light up the entire tunnel that it mines. it also automatically dumps the items into a chest. The turtle can be operated manually via the manual miner program or with another computer that has buttons that operate the turtles

Mods needed:
  • ComputerCraft
  • Chunky Peripherals (optional but highly recommended)
General Notes:
Any quotes (“) in the instructions should be left out. Only type in what is within the quotes
Parentheses (brackets) that are within the quotes are needed. Don’t leave them out
Everything that is typed in is case sensitive (Caps do matter)
Things encased in square brackets ([ and ]) are things you decide to enter. Don’t type the brackets in eg [name] means enter a name here (enter “Jane” not “[Jane]” without the quotes)

Pastebin Enabled
Make sure that your computer craft is pastebin enabled. Find out by going to your config folder in your minecraft file, find the computer craft config file, open it in wordpad or notepad. Look for this line:
# Enable the "http" API on Computers (see "http_whitelist" for more fine grained control than this)
B:http_enable=true

If your http_enable=false change the false to true. This allows you to download files from pastebin.

Start-up Program
This is a program that will start whenever the computer starts up. Most of the time this will be when you start up your game.
First we need a program named start up so type “edit startup”. This takes you to a blank screen. Type in this screen “shell.run(“[program name]”)” (the quotes in the brakets are important. The program name is obviously the one that you want to run when the computer is started up. Now press Ctrl button on your keyboard use the left and right arrow keys to select the save option and press enter. Do the same but select exit and press enter. Now hold Ctrl + R for about 5 seconds. This reboots the computer.

There is a video explaining the setup. I recommend you watch the video as the written instructions can get a bit confusing. Especially for the Remote Miners code. Check it out on YouTube. Link below:

Video coming soon.





Manual Miner

This is a program that I developed for early game use (as early game as a turtle gets). You just need a turtle and a chunk loader peripheral (little bit hard to craft I know). This is a basic program. If the chest that are needed are not stocked well and often then the turtle may run out of fuel, torches or won’t be able to put the items anywhere. This could lead to the turtle getting lost in the tunnel, the tunnel being dark so mobs spawn, or the turtle will run back and forth from the area its mining to the chest to try and place items. A big waste of Coal.
Instructions:
  • Craft a turtle
  • Turn it into a mining turtle
  • Craft a chunk loader peripheral for Chunky Peripherals (optional but highly recommended)

Posted Image

  • Place down the turtle
  • To the right of the turtle place a chest (can be a double chest)
  • Place a chest on top of the first one and another on top of the second one

Posted Image
  • Place torches in the middle chest and coal in the top chest
  • Open the turtle (right click) and type in “lua” and press enter
  • Put coal in the first slot (as much as you want but it will all be used so be careful)
  • Type in “turtle.refuel()” and press enter (this uses the coal in the first slot to fuel the turtle)
  • Put the Chunk Loader peripheral into the first slot (only if you did step 3)
  • Type in “turtle.equipRight()” and press enter (not “equipright()”!) (only if you did step 3)
  • Type in “exit()” (this closes the Lua interface)
  • Type in “pastebin get kxQTZqZc [program name]” (this downloads the code, program name is what you will type to start the program)
  • To run the program simply type in the name that you called it (The program name for previous step)
  • It will ask you how far you would like to mine
  • Enter a value and walk away (be reasonable. It can do 10000 blocks but if you close the game while the turtle is running it will be stuck where it last mined)
  • It is advisable that you automatically empty the chest that stores items and fill the chest that have coal and torches
  • Before closing the game make sure that all turtles are home so that you won’t lose any. (program stops when game is closed so turtle doesn’t come home)

Remote Miner (Advanced)

WARNING! This setup is complex. The guide is designed to be easy to follow but there are many steps. Basic knowledge on how to use the code editor required. You do not need to know how to code however.
This is intended to be a lot later game. It requires gold and ender pearls as well as quite a lot of other resources. A good items sorting and chest stocking infrastructure is advisable (one such as an AE system). For the mining program you will need:
  • a computer (possibly more than 1, advanced or basic)
  • advanced monitors (12 of them)
  • mining turtles (max 4) (make sure the pickaxe is on the left of the turtle)
  • a wireless modem for each turtle and one for the computer
  • a Chunk Loader peripheral for each turtle
  • chests (at least 3 per turtle)
  • wired modems (or wireless. Discussed later)
  • Networking cable (Not needed for wireless setup)
  • The ID’s of all the computers you will use including turtles (just type id into the computer interface to get the ID)
  • It is advisable that you chunk load the area where your turtles are (I recommend chicken chunks)
Instructions:
  • Craft the items in the above list
  • Turtle setup:
    • Dig a 3 by 3 by 2 deep hole in the wall
    • Place the turtle at the bottom row in the middle of the wall
    • Place a chest to the right of the turtle (single or double)
    • Place a chest above the one just placed and another above that (see diagram in Manual Miner instructions)
    • Leave the bottom chest empty (automatically emptying the chest highly advised)
    • Place torches in the middle chest and coal in the top one
    • Now open up the turtle’s interface
    • Type “lua”
    • Place coal in the highlighted slot in the turtles inventory (don’t need more than one piece but you can put more)
    • Type “turtle.refuel()”
    • Now put a wireless modem in the highlighted slot
    • Type “turtle.equipRight()”
    • Type “exit()”
    • Place a Chunk Loader peripheral in the 15th slot (3rd slot in the last row)
    • Type “pastebin get 9XtwSprN [name]” (no spaces in the name)
    • You can now make a start-up program (see guide above, Program name is the name you gave it in step 15)
    • Repeat for the turtles you have (up to 4 turtles)
  • If you wish to use the Move button (moves the turtle to a mining position behind it)
    • Dig 6 blocks behind the turtle (in 3x3 pattern)
    • Replicate the chest setup from the previous step making sure the chests are on the right if you face the mining wall (back towards the turtle)
  • Computer setup:
    • Place down a computer in the desired location(advised to sink it into the floor)
    • This is your main computer
    • Above the computer place the advanced monitors 3 tall by 4 across
    • On the right hand side of the computer (not the monitors) place either a wireless modem (if close to the turtles) or a wired modem (shift right click)w
    • Open the computers interface (right click)
    • Type “pastebin get HRbMF1Eg button” (important that it is called button)
    • Type “pastebin get ScASCfjj [name]”
    • Type “edit [step 7 program name]”
    • Go to line 17 to 20
    • Replace the Number after the “=” with the ID’s of your turtles (if you don’t have 4 turtles then leave “0” in the place of the ID you don’t have)
    • Save and Close the editor
    • Create a startup program of step 7 program
    • If the computer is far from the Turtles (ie in your house above ground) then place another computer close to where the turtles are
    • This is the Repeater Computer
    • If you do so place a wired modem on this computer (left or right side)
    • Place also a wireless modem on the computer (left or right side)
    • Create a start-up program with the program repeat (shell.run(“repeat”)
    • Above the shell.run line type “rednet.open(“left”)” and on the line above that type “rednet.open(“right”)” (go to beginning of line and press enter to get a line above)
    • Save the program and exit the editor
    • Run networking cable from the wired modem on the main computer to the wired modem on the Repeater Computer
    • Get the ID of your main computer
    • Reboot the two computers (hold Ctrl + R)
  • Go back to your turtles and type “edit [turtle setup step 15 name]”
  • Go to line 11 of the code
  • Change the number after the “=” to the ID of the Main Computer (do this for all turtles)
  • Save and Exit the editor
  • Reboot all turtles (hold Ctrl + R)
  • To use the Controller:
    • For mining click (right click) the distance you would like to mine (Right of the screen) the button turns green
    • Then click the turtle that you would like to do the mining (left of the screen) the distance button turns red and the turtle button turns green
    • When the turtle is done mining the turtles button turns red
    • To move the turtle to the new mining position set up in step 3 click the “move” button then click the turtle that you want to move
    • The turtles button goes back to red when it has completed the move
    • The “C” and “T” button above move indicate is there is torches and coal in the chest Green means there is and red means that you need to refill the chests
    • The turtle will stop mining until the chest are filled and will continue to mine after the chest are refilled (may take so time for turtle to register that the chest are filled 10 seconds at the most)
    • The “reset” button are in case you make a mistake. If you click “50” but wanted to click “100” for instance then just press reset until all distance buttons are red then select the correct distance
    • Same for “move reset”
    • Can’t reset the turtles once they are mining
    • Don’t click the turtle button after it has been sent mining as this will change the colour to red and give a false reading as to the completion of the mining
    • Please don’t exit the game until all turtles have completed their mining. Doing so will result in you having to run down the tunnel looking for the turtle. Picking it up and redoing the whole turtle setup.
    • Should the game crash while the turtles are mining:
      • Then run down the tunnel the turtle made find the turtle
      • Type “label set [name]” this prevents the turtle from losing the programs
      • Pick up the turtle and take it back to the start position
      • Repeat steps 7 to 14 of the turtle setup
That is the end of the instructions. That was long. At least now you have an 4 turtle army to do your mining for you.

About the code:

I have spent over 30 hours developing this program. I did it as a fun, little project to test my skills and also helped me to learn a new programming language (lua). It also helps me with the bane of my time playing minecraft and that is the mining part of it. In the past I have tried to program a turtle to do the mining for me. Never has it succeeded until now. Now I can just leave the turtles to mine while I do other things.

Thanks:

I would like to thank Bomb Bloke and KingOfGamesYami. Both have been a tremendous help with my program and it definitely would not have been completed without their input. Also thanks to direwolf20 whose button API I used.

Conclusion:
Please don’t hesitate to give me suggestions and constructive criticism. Please no hate. Anyone that wants to use my code is welcome. Anyone that wants to edit my code and improve it is welcome with one condition: I would like to be thanked for the writing of the original code.

Please if you like the code recommend it to friends.
Edited by Robert1707, 19 July 2015 - 10:31 AM.
Quote