[INACTIVE][MECH] Growbie 2.4 [561-928]

Discussion in 'Inactive/Unsupported Plugins' started by Afforess, Mar 5, 2011.

  1. Offline



    An extension of bonemeal - supports growing pumpkins, grass, leaves, flowers and mossy cobblestone!

    Original Author: @UnixSystem
    Other Contributors: @cyklo, @maczydeco
    Current Project Maintainer: @Afforess

    • Bonemeal can spread pumpkins
    • Bonemeal can spread yellow flowers
    • Bonemeal can spread red roses
    • Bonemeal can spread grass on dirt
    • Bonemeal can spread mossy cobblestone on cobblestone
    • Bonemeal can spread leaves onto adjacent dirt/grass
    • Bonemeal can grow leaves from logs
    Change Log:
    • Version 2.0
      • Updated to latest Bukkit Standards
      • Added Leaf growth
      • Bonemeal is not subtracted from the inventory if no growth occurs
      • Licensed Growbie CC SA 3.0 (was public domain)
    • Version 2.1
      • Added Cyklo's Better Tree Growth algorithm
    • Version 2.2
      • Improved Code Structuring
      • Plant Spreading
    • Version 2.3
      • Updated for CB builds 561+
    • Version 2.4
      • Removed Better Trees (obsolete)
      • Added Success Chance for spreading plants & blocks.
  2. Offline


    nice as always, Afforess
    Lavalamp52 likes this.
  3. Offline


    How this works? you drop bonemeal on cobblestone and in a few time your castle is a moss-stone caslte? or your grasslands are filled ith roses in a litttle time after placing bonemeal on the grass near a single rose?
  4. Offline


    You use bonemeal the same way you use bonemeal to insta-grow trees or crops in vanilla. Put it in the a quick slot, and "use" it on a block. Pretty basic.
  5. Offline


    ah well ye i'd never used it ;)
  6. Offline


    Awesome Afforess... I suggested this plugin ages ago, and to my dismay it was abandoned shortly after. Thanks for picking up the pieces and soldiering on!

  7. Thanks a lot for taking on this project, Afforess :).
  8. Offline


    As another biological consumable with finite quantities, have you looked at some method of generating pine and birch trees (or at least their relevant log types)?

    I was considering hooking into the bonemeal-on-sapling event, but to latch on to the tree generation code looked like too much work. Perhaps some kind short-cut method?
  9. Offline


    There is a world.generateTree that supports different tree types. What about cancelling the item use event, and running your own tree generation on the spot.
  10. Offline


    Thank you very much Afforess. This is awesome.
  11. Offline


    I've written a patch which should do something like that. It adds a boolean top-level config key "better_trees", which, if true, will generate trees suitable to the current biome.

    Took the probabilities from the minecraft forums, but may be a bit off - birch definitely exists in the rainforests. If you include this, you may want to play with the numbers a bit.

    Follows from your commit db4e41

    From 214ea952bbe4cca71147f40b2db1cc524be7be1f Mon Sep 17 00:00:00 2001
    From: Robert Sargant <[email protected]>
    Date: Sun, 6 Mar 2011 19:00:11 +0000
    Subject: [PATCH] Added biome-specific sapling growth with bonemeal
     src/com/afforess/growbie/Growbie.java              |    9 +++++
     src/com/afforess/growbie/GrowbieBlockListener.java |   38 ++++++++++++++++++++
     src/config.yml                                     |    3 ++
     3 files changed, 50 insertions(+), 0 deletions(-)
    diff --git a/src/com/afforess/growbie/Growbie.java b/src/com/afforess/growbie/Growbie.java
    index 8072787..d1e4ce4 100644
    --- a/src/com/afforess/growbie/Growbie.java
    +++ b/src/com/afforess/growbie/Growbie.java
    @@ -27,6 +27,7 @@ public class Growbie extends JavaPlugin {
         private final GrowbieBlockListener blockListener = new GrowbieBlockListener(this);
         private HashMap<Material,Integer> growablePlants;
         private HashMap<Material,Material> growableBlocks;
    +    private Boolean betterTrees;
         public void checkConfigFile() {
             // create config file if it doesn't exist
    @@ -73,6 +74,10 @@ public class Growbie extends JavaPlugin {
                     if (m[1] == null && e.getValue() instanceof Integer) m[1] = Material.getMaterial(((Integer)e.getValue()).intValue());
                     if (m.length == 2 && m[0] != null && m[1] != null) growableBlocks.put(m[0], m[1]);
    +            // load better trees option
    +            betterTrees = getConfiguration().getBoolean("better_trees", false);
             } catch (Exception e) {
                 System.out.println("Growbie: error loading configuration");
    @@ -109,6 +114,10 @@ public class Growbie extends JavaPlugin {
         public boolean isGrowableBlock(Material m) {
             return growableBlocks.containsKey(m);
    +    public boolean isSapling(Material m) {
    +        return (betterTrees && (m == Material.SAPLING));
    +    }
         public Material blockForGrowableBlock(Material m) {
             return growableBlocks.get(m);
    diff --git a/src/com/afforess/growbie/GrowbieBlockListener.java b/src/com/afforess/growbie/GrowbieBlockListener.java
    index d16f88c..4ab6080 100644
    --- a/src/com/afforess/growbie/GrowbieBlockListener.java
    +++ b/src/com/afforess/growbie/GrowbieBlockListener.java
    @@ -1,6 +1,7 @@
     package com.afforess.growbie;
     import org.bukkit.Material;
    +import org.bukkit.TreeType;
     import org.bukkit.inventory.ItemStack;
     import org.bukkit.block.Block;
     import org.bukkit.entity.Player;
    @@ -109,6 +110,43 @@ public class GrowbieBlockListener extends BlockListener {
                 if (didGrow) {
    +        } else if(plugin.isSapling(block.getType())){
    +            // Biome data stolen from here
    +            // http://www.minecraftforum.net/viewtopic.php?f=1020&t=151067
    +            // Seems slightly incorrect though... definitely get some Birch in rainforests
    +            // May need to play with probabilities
    +            TreeType treeKind = TreeType.TREE;
    +            Double treeRoll = Math.random();
    +            switch(block.getBiome()) {
    +            case RAINFOREST:
    +                if(treeRoll <= 0.33) { treeKind = TreeType.BIG_TREE; }
    +                break;
    +            case FOREST:
    +                if(treeRoll <= 0.20) { treeKind = TreeType.BIRCH; }
    +                else if(treeRoll <=  0.47) { treeKind = TreeType.BIG_TREE; }
    +                break;
    +            case TAIGA:
    +                if(treeRoll <= 0.33) { treeKind = TreeType.REDWOOD; }
    +                else { treeKind = TreeType.TALL_REDWOOD; }
    +                break;
    +            default:
    +                if(treeRoll <= 0.10) { treeKind = TreeType.BIG_TREE; }
    +                break;
    +            }
    +            block.setType(Material.AIR);
    +            if(!block.getWorld().generateTree(block.getLocation(), treeKind)) {
    +                block.setType(Material.SAPLING);
    +                // We do not need to use useItem() as this will pass
    +                // through to the Minecraft engine and also fail,
    +                // consuming the bonemeal itself
    +            } else {
    +                useItem(player);
    +            }
    diff --git a/src/config.yml b/src/config.yml
    index 46c53ce..e6c3b7d 100644
    --- a/src/config.yml
    +++ b/src/config.yml
    @@ -16,3 +16,6 @@ growable_blocks:
       DIRT: GRASS
       LOG: LEAVES
    +# set for better trees (biome-specific randomized types)
    +better_trees: true
    \ No newline at end of file
  12. Offline


    Thanks! I've merged your patch in.
    --- merged: Mar 6, 2011 7:55 PM ---
    Updated to v2.1, with Cyklo's better tree algorithm that grows birch and redwood trees in their specific biomes. If you want the option to appear in your config, delete the existing config and it will be re-created.
  13. Offline


    Have a weird issue on my server about 6-8 chunks outside one of the players building area just will not grow anything using the mod. No console error or anything just refuses to work. Growing trees from saplings still work. Not very helpful I know but thought I would post it.
  14. Offline


    You're not crazy - noticed something strange like that too. I downloaded the latest bukkit builds, restarted the server, and it went away.
  15. Offline


    Please test your plugin with the latest Recommended Build (493) and update your release post accordingly as it is now a requirement of the submissions process, since the newest RB contains breakages.
  16. Offline


    Played around with the title. I've been using the RB for days. ;)
  17. Offline


    This works great! I just installed bukkit tonight and a couple other plugins I tried were outdated, but this is wonderful!

    I like the idea behind it too, the idea of bonemeal being more useful and resources being replenish-able. :D
  18. Offline


    Using 493 and after a server reboot it worked fine. odd.
  19. Offline


    I really think that bone meal should have this functionality natively, thanks for this plugin!
  20. Offline


    Could it be made to where you need bordering mossy cobblestone to grow more?
  21. Offline


    nice plugin!
    but i agree with the point, that you should need an adjacent mossy to grow/spread more of them
  22. Offline


    You've heard of this enough or more than enough, but Permissions support? :D
  23. Offline


    Hm, how about treating cobblestone both ways, and making it possible for the server admin to turn off the "block" method if needed, e.g. two ways:
    • Bonemeal on cobblestone -> mossy cobblestone
    • Bonemeal on mossy cobblestone -> spreads to random neighbouring cobblestone
    This would have two advantages - being able to turn off the "moss out of nowhere" behaviour, and speeding up the spread of moss should you have a "seed block".

    Same could go for re-turfing grass, now I think of it.
  24. Offline


    Probably worth an extra configuration column.
  25. Offline


    This is a great pluggin. I disabled the mossy cobblestone function with a "#" in front of that line, but if cyklo's suggestion above is implemented, I might use it.
  26. Offline


    It's already implemented, it's just that no new version has been released yet. If you can build it yourself, the source code is freely available: https://github.com/Afforess/Growbie
  27. Offline


    I just have to start by saying this is a great plugin. I would like to know if it is it possible to add support for growing mushrooms, sugar cane and cactus with this? Thanks again for making this.
  28. Offline


    Mushrooms already work. Sugar cane and cactus, not yet - but they grow pretty fast anyway, don't they?
  29. Offline


    So I see about the mushrooms. They weren't mentioned so I thought I'd ask and mention the cactus and sugar because they would fit in with the rest of the items. Great job.
  30. Offline


    That's very handy. Great little addition to my server!

Share This Page