Crops Performance Plugin

Discussion in 'Archived: Plugin Requests' started by teamcraft, May 23, 2013.

  1. Offline

    teamcraft

    Plugin category: Server Mods / Mechanics

    Suggested name: GrowthControl

    What I want: I need a tool to easily adapt crops growth rate (wheat, sugarcane, etc.) to any server's needs.

    This can be used to make crops harder (slower) or easier (faster) to farm or just improve a little your server performance by slowing down growth by cancelling a configurable % amount of GrowthEvents.

    Mostly, I'd like this plugin to focus on performance letting server owners reduce the load that crop growth can cause, even stopping the growth if neccessary. This can be done ignoring (cancelling) a configurable % of growthEvents every tick.

    It would have a simple config.yml file where basic configurations should be made like:

    config.yml
    #Setting growthSpeed to zero will stop crop grow in your server. Default growth speed is 100.
    GrowthSpeed: 60
    #Ignore list will exempt that crop type from growth speed modifiers
    IgnoreList:
    - wheat (or 59)
    - sugarcane (or 83)

    Ideas for commands:
    /grc reload (reloads the config.yml file data and restarts the plugin)
    /grc ignorelist add <cropname>|<cropID> (adds the specified crop / ID to the ignore list)
    /grc ignorelist remove <cropname>|<cropID> (removes the specified crop / ID from the ignore list)
    /grc growthspeed <speed> (changes the config.yml GrowthSpeed setting. Needs to reload the plugin to apply the changes)

    Ideas for permissions: growthcontrol.admin (grants the user access to all plugin commands. Default OP).

    When I'd like it by: ASAP.


    I know there are some advanced plugins that can make close things like this one, but they're more complex and not focused on improving server performance (that's why I'm making this request). I think you can even use some of them to make a little reverse engineering and improve it to fix these needs! :p

    Thanks in advance!
     
  2. Offline

    teamcraft

    Bump time
     
  3. Growth in minecraft is controlled by random block updates, every tick (1/20s) a 'random' block is updated in each loaded chunk. If that block happens to be wheat/sugarcane whatever it will be updated and grow.
    So the way slowing growth using that system (yes you can change that system, but you probably wanna stick with it, because if you don't you won't improve performance but wreck it, which even the following method does, so this plugin would not improve performance whatsoever, but change the growth speed under the cost of a tiny bit of performance) would be to add a chance of the growth being allowed or denied, that would disallow speeding the process up.
    So if you are looking in an improvement of performance, you are approaching it from the wrong direction.
     
  4. Offline

    teamcraft

    Ok, but I thought, according to the BlockGrowEvent inheritance diagram ( http://jd.bukkit.org/rb/doxygen/d0/dea/classorg_1_1bukkit_1_1event_1_1block_1_1BlockGrowEvent.html ) that avoiding that block event to complete would improve performance due to a "no state change" so no more action taken in a while with that block nor save new state...

    What's the approach this may need if I am wrong?
     
  5. To really see what is happening you have to look into the modded NMS source:
    https://github.com/Bukkit/CraftBukk.../java/net/minecraft/server/BlockReed.java#L27
    An event is called and the block is changed, so if you want to prevent that you change the block twice, which ofcourse doesn't improve performance.
    If you replace the BlockReed class with a custom BlockReed class (which doesn't impact the performance when done) and add a probability to the code you would add a check for probability to be calculated which still wouldn't improve performance, but let the cropy grow slower. The growing of crops is not the place to improve performance whatsoever(if you don't totally disable it or just want the functionality of having crops growing slower, which would be fine).
     
  6. Offline

    teamcraft

Share This Page