Tree Generation

Discussion in 'Plugin Development' started by wesley27, Feb 6, 2016.

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

    wesley27

    Hello, I'm trying to get the location of trees out of a configuration file and then generate them. It works perfectly fine... for the most part.

    For every tree type, my code gets the correct location information out of the configuration file. However, when generating the trees there is a slight problem - not all tree types generate every tree. By this, I mean:

    When I run the code to pull oak or birch trees out of the config file and generate them at their locations, every single tree generates. However, when I do this for any other tree type(redwood, dark oak, acacia, jungle), it only generates 2-5 of the trees.

    Is there a reason for this? Can bukkit/Minecraft only generate a certain number of those trees in a certain amount of time? Is this a bug with generateTree()? If anyone could offer any help it'd be greatly appreciated!

    Thanks!

    Oh, and I don't think my code is really relevant because it works entirely(unless there's a different way to get all of the non-oak/birch trees to generate. But, just in case, here it is:
    Code:
    public void resetTrees(int level) {
            String treeType = "";
            TreeType tree = TreeType.TREE;
            if(level == 1) {
                treeType = "oak";
            }
            if(level == 2) {
                treeType = "birch";
                tree = TreeType.BIRCH;
            }
            if(level == 3) {
                treeType = "spruce";
                tree = TreeType.REDWOOD;
            }
            if(level == 4) {
                treeType = "jungle";
                tree = TreeType.SMALL_JUNGLE;
            }
            if(level == 5) {
                treeType = "acacia";
                tree = TreeType.ACACIA;
            }
            if(level == 6) {
                treeType = "darkoak";
                tree = TreeType.DARK_OAK;
            }
           
            String[] treeLocs = treelocations.getString(treeType).split(",");
           
            for(int i = 0; i < treeLocs.length; i++) {
                 String[] trees = treeLocs[i].split(" ");
                 BukkitWorld w = new BukkitWorld(Bukkit.getWorld(trees[0]));
                 int x = Integer.parseInt(trees[1]);
                 int y = Integer.parseInt(trees[2]);
                 int z = Integer.parseInt(trees[3]);
                 EditSession es = new EditSession(w, 5000);
                 Vector loc = new WorldVector(w, x, y, z);
                 w.generateTree(tree, es, loc);
            }
        }
     
  2. Offline

    wesley27

    Bump, anyone know anything about this?
     
  3. Offline

    wesley27

Thread Status:
Not open for further replies.

Share This Page