Solved Getting an entire tree

Discussion in 'Plugin Development' started by hawkfalcon, Sep 27, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    hawkfalcon

    I have an iron golem go to random trees and hit them, but how do I get all the blocks in the tree so I can make them fall? :p
     
  2. Offline

    chaseoes

    Keep adding and subtracting 1 to the y axis and get all the blocks that are logs?
     
  3. Offline

    Courier

    Not all trees are entirely one column.

    I think jungle trees can even have wood blocks that are not even touching (even edges/corners) any other wood blocks. Not sure.

    Make a HashSet of blocks. Populate it initially with the block that the golem hits. Loop through all the blocks nearby it, and check if they are wood blocks (of the same type as the original wood, the lowest bits of the data tell you what type of tree it is). Add them to the HashSet if they are. Then loop through blocks nearby the new block. You can use recursion or iteration to do this.
     
  4. Offline

    andf54

    hawkfalcon likes this.
Thread Status:
Not open for further replies.

Share This Page