This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
deeno's profile picture

MiningTurtle + BeeHive

Started by deeno, 13 November 2012 - 07:33 AM
deeno #1
Posted 13 November 2012 - 08:33 AM
Hello everyone. I am using Forestry (and Extra Bees) and whenever a turtle comes to a hive it breaks it and destroys it, and the bees inside. This has resulted in me deciding I will have to create a custom excavation program, however I have ran into a small problem. Is there anyways for the turtle to determine any information about a block (i.e. id, meta-data, block name, etc) when it is touching it? The only way I can think of to avoid the turtle killing the bee is to somehow detect what a block is and if it encounters a hive, go around. Can anyone provide me some information on this? I would be very thankful.

Regards
~Deeno
XoX #2
Posted 13 November 2012 - 08:51 AM
You have 2 options to get information about a block.

a.) You get a peripheral which lets you get more information about blocks, there is many that output the block ID.
b.) You can use turtle.compare() to compare the item in front of the turtle ( or compareUp / compareDown ) with the current selected slots. Now with this you would have to have the block in question in the turtles selected slot and then you can use compare to determine if the block in front of the turtle is said block.
Lyqyd #3
Posted 13 November 2012 - 08:51 AM
You have two options: give the turtle all of the blocks you do want it to dig and have it check each block before it digs it to see if it matches one of the blocks it has in its inventory, or give it a hive block and have it check each block against the hive and not dig it if it matches. Either way, you'll be using turtle.compare(), which compares the block in the current slot against the block in front of it. See the turtle API page in the wiki for more information.