1
\$\begingroup\$

I am working on coding a bot for Minecraft in Java. The first step is to find trees in the world. I am using mcp-reborn (so basically the source code) but answers in Forge can also be useful to me. I am trying to find the locations of all the trees. Using a loop to keep branching off in all directions searching for logs is the first thing that came to my mind. The issue is, this is very inefficient and can take a very long time. I am thinking that since I have access to the world seed, I could try to get the locations of all the trees by regenerating just the trees. This does not sound like a good solution either, and even if it was, I have no clue how to implement something like that.

So my question is, what is the most efficient solution to getting the locations of all the trees in a Minecraft world (or few chunks around player)? Again, answers in MCP or Forge will both be useful to me. One important thing to note is my code cannot run during world generation; it has to find the locations of all trees after the world has completed generating. Here is an example of how the function that I am looking for would look:

public static List<BlockPos> getAllTheTrees(World world, long seed, ... whatever else is needed ...) {
    ...
    return ...
}

Thank you so much for your help! Have a great day ;)

\$\endgroup\$

0

You must log in to answer this question.

Browse other questions tagged .