[INACTIVE][MECH] TreeHugger v0.7c - fit trees to your needs

Discussion in 'Inactive/Unsupported Plugins' started by MadMichi, Jan 18, 2011.

  1. Offline

    MadMichi

    [​IMG]TreeHugger v0.7c


    Do you find it annoying when you chop wood and all these leaves are hanging in mid-air?
    And why don't trees drop apples or leaf blocks?
    If you ever asked one of these questions TreeHugger is the plugin for your server!

    [​IMG]

    What is TreeHugger plugin?
    For now TreeHugger has following features:
    1. It can disable the automatic leaf-decay.
    2. It can spawn apples, golden apples, saplings and/or leave blocks where ever leaves are destroyed.
    3. It can slightly increase the amount of decaying leaves.
    4. It can slightly increase the amount of leaves destroyed by the player at once.
    5. It can drop the treetop. Chop all the wood out of a tree top and all clustered leaves (not connected to the ground or other kinds of blocks) will be destroyed. Now a whole tree can be dropped with all wood in it by destroying the trees connection to the ground.
    6. Harvest items only when user defined tools are in the hand of the player.
    7. Any type of block or item can be dropped if leaves are destroyed.

    More to come... stay tuned for updates.

    How to install TreeHugger?
    Download the TreeHugger.jar and put it into your plugins folder. After the first launch of the server, a properties file named TreeHugger.properties will be added to the folder "\plugins\TreeHugger\". Now you can configure as you wish and restart the server.

    If you like you can also move the properties file to the bukkit root folder an delete the TreeHugger folder in the plugins folder.

    Please delete old TreeHugger.properties if you install a newer version.

    What is in the TreeHugger.properties file?
    The file consists of:
    destroy-all=true|false
    # Activate destruction of all clustered floating leaves. Leaves connected to wood / dirt / etc. won't be harmed.
    destroy-wood=true|false
    # Activate destruction of whole tree with wood if connection to the ground is lost.
    leaves-decay=true|false
    # Here you can activate/deactivate the new old automatic decay of leaves.
    faster-decay=true|false
    # Leaves decay slightly faster but drop less items. If leaves-decay ist false, faster-decay is ignored.
    player-destroys-faster=true|false
    # Player destroys more leafe blocks at once but drops less items.
    items-to-harvest=item id|item string, item id|item string, ...
    # Define tools that make harvesting the items possible. You can use item ids and strings separated by comma
    dropping-apples=[0.00-100.00]
    # 0% to 100% chance of apples dropping if leaves are destroyed.
    dropping-golden-apples=[0.00-100.00]
    dropping-leaves=[0.00-100.00]
    dropping-saplings=[0.00-100.00]
    # do i really have to tell you? :p
    #Append your custom drops as followed (without the #). Examples:
    #dropping-custom=dirt,1.5
    #dropping-custom=46,20
    #This would drop dirt with a chance of 1.5 percent and tnt (id 46) with a chance of 20 percent.

    Changelog
    v0.1 Initial release.
    v0.2 Added validation for the properties file.
    Also the percent values take now float with two decimal places.
    v0.3 Two new settings in the properties file: faster-decay & player-destroys-faster.
    Fixed Bug where a percent value of 0 rewrote the properties file.
    Fixed Bug where only one of the desired items coud drop from one leafe block at a time.
    v0.4 New setting in properties file. DropTreeTop functionality.
    v0.5 Items drop correctly now if the tree top explodes.
    v0.6 New settings in properties file. Drop tree with all the wood in it. Harvest only with user defined tool in hand. Drop any kind of block or item from leaf blocks.
    v0.6a Fixed a bug where too many clustered blocks crashed the algorithm and spammed the server console with error messages.
    v0.6b Fixed a bug where no selected harvest tools lead to no item drops.
    v0.6c Fixex a bug where trees with snow on it wouldn't explode.
    v0.7 Slightly more trees do drop down at once. Properties file can now be in bukkit root directory or in "\plugins\TreeHugger" directory. Trees now drop from the first chopped log block upwards. Correct log blocks are now dropped (birch, dark). Thanks Nijikokun!!
    v0.7a Had to temporarily deactivate the correct drop of wood colors since errors with new craftbukkit release.
    v0.7b Wood colors reactivated.
    v0.7c Quickfix for MC1.3. Reduced tree drop count, hopefully less console errors now.


    Todo
    - rewrite the drop treetop algorithm without recursion so that more clustered trees can be dropped at once
    - make all dyes droppable
    - try to make TreeHugger work with Permissions
    - option for treedestruction even if connected to other blocks
    - option to disable fast grow a tree with bonemeal

    Known Bugs
    - console spams errors if many blocks are affected by TreeHugger functions - will be fixed when the first point from the todo list is done


    Please leave comments / requests / bugs / hatemail / etc.

    Special thanks to:
    Nijikokun, MarkusNemesis, QuantumAI and DjDCH and all the programmers who are dispensing their help in the development forum.

    Also big thanks to the Bukkit-Team for their awesome work!

    Very special thanks to:
    [diamond]Affecting_Nelas[diamond]
    for coding the new drop treetop functionality!

    Greetz MadMichi
     
    PoPsou, Ola and chibirubara like this.
  2. Offline

    comradesasha

    For my test I selected a 17*33 block, worldedited air walls to isolate the selected test sample (which was now 15*31) from the main forest. After breaking all the connections to the ground, I proceeded to make the test sample smaller in the 31 dimensions by multiples of two. When I reached approximately 15*14 everything exploded.

    Estimating from the amount of tree and leaf blocks replaced with air every time I cut off a two layer thickness, I would guess the 15*14 critical control volume had 1400-1700 blocks total of logs and leaves.

    Pictures is the original test sample. As can be seen it's a very thick forest with trees about 10-15 max height.

    Any way to add an alternate algorithm that does the following?
    On log break, check any of the nearby logs(within a radius of 1 - that is a 3*3*3 cube with the broken log block in the center) if they are connected to ground directly or indirectly, if not -> explode(logs only, not leaves)
    Above loop might work on thick forests like mine.

    [​IMG]
     
  3. Offline

    MadMichi

    Good guess. :D 2000 blocks is the current maximum. In the next release it will be 2400.
    The problem is the current recursiveness of my algorithm. It is running out of stack memory. I will try to rewrite it numerically. I hope then you will be able to cut the whole forest down at once ;)
     
  4. Offline

    Nijikokun

    In linux it creates '.\plugins\TreeHugger\' and '.\plugins\TreeHugger\TreeHugger.properties'
    http://eypic.com/ss563722a.png

    Invalid directory scheme.

    Please fix it.
     
  5. Offline

    MadMichi

    Oh, as soon as i will be home, i will have a look... there i have a virtual mashine. :oops:
    Thanks for reporting!
     
  6. Offline

    Nijikokun

    Also, it only gives regular wood and not birch wood or the other color wood. :p

    Note: To do this you have to use the third variable on new ItemStack it would be like this:
    Code:
    event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation(), new ItemStack(Material.LOG, 1, event.getBlock().getData()));
    For the directories:
    Code:
    File.separator
    Instead of "\"
     
  7. Offline

    MadMichi

    I've uploaded an untested fix for the directory problem. Would you test it for me Nijikokun?
    Thanks in advance :)
     
  8. Offline

    Nijikokun

    Works. Now to the next issue!
     
  9. Offline

    MadMichi

    Fixed! [​IMG]
     
  10. Offline

    Nijikokun

    :D I don't know if it's a bug or a wanted feature, but with faster tree.. thing off (haven't tried with it on) after two hits some trees just... *poof* into blocks.
     
  11. Offline

    MadMichi

    The settings faster-decay and player-destroys-faster only speed up the corresponding process. The *poof* effect is caused by the settings destroy-all respectively destroy-wood.
     
  12. Offline

    Bacu

    could I ask for a direct download link so I can grab it with wget?
     
  13. Offline

    MadMichi

    You can download the .jar file from the following address:
    http://dl.dropbox.com/u/19919749/TreeHugger.jar
    As long as the file name doesn't change or anything else this link will point to the newest release.
     
  14. Offline

    Gimmic

    Just wanted to say we've been using your plugin and loving it. Thank you.

    Sometimes chopping down the entire tree can be a little 'janky'.
     
  15. Offline

    MadMichi

    Thank you very much! Those postings motivate people to write plugins ^^

    Although the credits for the original idea go to Atroxide from the hey0's mod forum ;)

    I didn't intend to port LeafDropper from hey0 to bukkit initially but as i tryed to implement everything requested they became very similar...
     
    Atroxide likes this.
  16. Offline

    DoomBunnyPwn

    Works great! Now i just need to find a way to make trees drop live TNT...I'm kidding, but I do love this plugin.
     
  17. Offline

    Planitia

    BUG: Someone on my server was building with dark wood and it suddenly dissapeared and dropped leaves saplings etc. It seems building with logs isn't safe atm if using this plugin
     
  18. Offline

    MadMichi

    I think that is not a bug, that is the expected behaviour. If you build something from wood and/or leaves and it is floating, you can't destroy one of the blocks without destroying all blocks. But as long as the wood/leaf blocks have any connection to other blocks it should be save.
    If you want your users to be able to rally safely build with wood/leaves try "destroy-all=false".
    If you still think it is a bug, please try to reproduce the situation and explain what happens.
     
  19. Offline

    Planitia

    Do these 'other blocks' include planks?
     
  20. Offline

    MadMichi

    Yes, 'other blocks' means any other type of block than air. For example if you have a floating cluster of wood and leaf blocks and you destroy one of them, the whole cluster will explode. But if in the middle of the cluster (or connected to the edge) is one plank block (or dirt, stone, etc.) it will not explode.
     
  21. Offline

    Planitia

    Awesome thanks :D
     
  22. Offline

    mudzereli

    I updated bukkit and am now get this error when I have destroy-wood=true

    Code:
    SEVERE: Could not pass event BLOCK_DAMAGED to TreeHugger
    java.lang.NoSuchMethodError: org.bukkit.inventory.ItemStack.<init>(Lorg/bukkit/M
    aterial;IB)V
            at com.bukkit.MadMichi.TreeHugger.TreeHuggerBlockListener.onBlockDamage(
    TreeHuggerBlockListener.java:148)
            at org.bukkit.plugin.java.JavaPluginLoader$17.execute(JavaPluginLoader.j
    ava:205)
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:60)
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:213)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:355)
            at net.minecraft.server.Packet14BlockDig.a(SourceFile:42)
            at net.minecraft.server.NetworkManager.a(SourceFile:232)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:71)
            at net.minecraft.server.NetworkListenThread.a(SourceFile:104)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:276)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:202)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:512)
     
  23. Offline

    MadMichi

    I quick fixed the error. But i had to disable the feature that made wood drop in the correct color (for now).
     
  24. Offline

    Derek S

    Awesome plugin! I would like to use this plugin to drop cocoa beans using the dropping-custom= option. How would I go about specifying the item id for this? I was able to find the item ids here. Using 351:3 errors out in the serer log when I try to harvest wood. Is this possible yet? If so, what syntax should I be using?

    Thanks in advance.
     
  25. Offline

    MadMichi

    For now you can only make ink sacks drop from leaves, but i will make the other dyes (the ones with the :integer) droppable in the next release.
     
  26. Offline

    RugRats

    d(TreeHuggerBlockerListener.java:96)
    at com.bukkit.MadMichi.TreeHugger.TreeHuggerBlockListener.dropTreeTopWood
    I get that when I try to join my server. Only it's a rapid spam of it. Please help
     
  27. Offline

    MadMichi

    Since when do you get this? What craftbukkit version do you run and have you downloaded 0.7b?
     
  28. Offline

    RugRats

    I'm using the newest version of craftbukkit. It worked last night now I just get that error. Yes I have the latest update fort he plugin.
     
  29. Offline

    MadMichi

    That is strange... i've just tested with craftbukkit 232 and it runs well...
    So it doesn't run since you've uptadet TreeHugger to 0.7b?
    If so please try to install the old 0.7a version from here and make a test run.
     
  30. Offline

    RugRats

    same error
    --- merged: Feb 3, 2011 8:19 PM ---
    This is an error with your plugin or something. Everything I'm running is 100% upto date and I see others have the same problem I have if you look at the posts on page 1 and 2.
     
  31. Offline

    MadMichi

    Sorry it took me so long to answer. Wrote a test today... :eek:
    The errors from the other pages are fiexed since v0.6a.
    Please try one more thing: move the word folder of your bukkit server temporarly to another place, so that it creates a new one. Then test again. Maybe it has something to do with the current world map.
    I have already asked two fellow students to run a test server and they both had no problems with newest craftbukkit and treehugger.
     

Share This Page