HLR (Crop hoppers) 1.3.2

A simple yet powerful hopper tweaker used mainly for lag-reducing purposes.

  1. despawningbone
    Tested Minecraft Versions:
    • 1.8
    • 1.11
    Contributors:
    despawningbone, ideas from various places/people
    Introduction
    HLR is a simple yet powerful plugin aimed to reduce entity lag by tweaking how hoppers work. Though, it only tweaks specific hoppers as not to completely change the vanilla experience. This plugin is especially helpful if your server has a lot of gigantic farms (including mob farms), such as typical skyblock or factions servers.

    How it works
    This plugin works by instantaneously moving any item entities found in the item list to specific hopper(s) in a chunk. This essentially eliminates a large amount of physics calculations of the item entities, and reducing overall entity count. It also eliminates bulky water channels, and increases farm efficiency by greatly reducing item loss by either flying out of the collection channels or being destroyed by cactus etc.

    Features

    - Configurable permission use
    - Configurable economy use and fee for /converthopper
    - Configurable item whitelist with default items inputted which can be disabled
    - Configurable chunk tweaked hopper limit
    - Configurable messages
    - Configurable cooldown use and time for /converthopper
    - Configurable hopper name and lore
    - Configurable amount of hoppers that can be converted at once
    - Configurable enabled worlds
    - Configurable farming tweaks
    - Lightweight


    Commands and permissions

    Code (Text):
    /converthopper - the main command of this plugin. Converts vanilla hoppers into specific hoppers.
    /HLR help - shows the help page for this plugin.
    /HLR reload - reloads the config file.
    /HLR about - about this plugin. Shows author and version.
    /HLR give - give an online player tweaked hoppers.
    /HLR revert - revert tweaked hoppers back into their vanilla state.
    Code (Text):
    /converthopper - HLR.convert
    Bypass fee charge (if set) for using /chopper - HLR.nofee
    Bypass cooldown (if set) when using /chopper - HLR.nocooldown
    Bypass conversion limit (if set) for converting hoppers - HLR.limitbypass
    Bypass chunk hopper limit (if set) - HLR.nochunklimit
    /HLR give - HLR.give*
    /HLR reload - HLR.reload*

    *These permissions cannot be disabled in the config.
    Lag test

    [NOTE] This lag test cannot fully represent its function as I cannot replicate a big enough simulation environment to extend the plugin to its full potential.

    This lag test is performed in about 60 seconds, with gamerule randomtickspeed set to 60. 2GB RAM was allocated to the server as an effort to increase server load (which failed). Essentials, worldedit, vault, PermissionsEx and the plugin was installed.

    Setups:
    With HLR:
    setup.png

    Without HLR:
    setup2.png

    Both are with a 23*13*182 cactus farm.

    Timings without HLR:
    lagtest2.PNG

    Timings with HLR:
    lagtest.PNG

    As you can see above, entity count and related events' PCT Ticks are heavily decreased, resulting in a lower server load.

    Configuration file

    Code (YAML):

    # -------------------------------
    #     HLR v1.3.2 config file
    #    Created by despawningbone
    # -------------------------------

    # Choose which worlds the tweaked hopper will work in.
    Enabled-in-worlds
    :
     - world
     
    # Here you can choose what type of items the tweaked hopper will take in.
    ItemList
    :
     # This includes all the common crops, i.e. Pumpkin, Cactus, Wheat, Seeds, Carrot,
      # Potato(including Poisonous ones), Sugarcane, Red/Brown Mushrooms, Melons and Nether warts.  
      Crops
    : true
      # This includes all the common mob drops, i.e. Feather, Raw chicken, Raw Beef, Raw Porkchop,
      # Raw mutton, Spider eye, Ender pearl, Bone, Arrow, Wool, Iron Ingot, Blaze rod, Gunpowder,
      # String, Gold nugget, Slimeball, Ink sack, Leather, Rotten Flesh, Prismarine Shard, Prismarine Crystals and Raw Fish.
      Mob-drops
    : true
      # Here you can add the custom items you want to be taken in by the tweaked hopper.
      # Please use Bukkit's material list's name.
      # For those items with a damage value, please do the item name followed by a colon, as shown in example 2.
      Custom-items
    :
     # - EXAMPLE_MATERIAL
      # - EXAMPLE_MATERIAL:1
        -

    # Here you can set how many hoppers can be converted at once.
    # e.g. Max-amount: 5, players can't convert a stack of hoppers with more than 5 hoppers in it.
    Max-amount
    : 10

    # Use permissions?
    Use-permissions
    : true

    # You can set how many tweaked hoppers can be in 1 chunk here.
    # set -1 for unlimited tweaked hoppers in one chunk.
    # any number is or larger than 16*16 will be the same as unlimited tweaked hoppers.
    Chunk-HopperLimit
    : -1

    # Retain the tweaked hopper or drop a new hopper upon tweaked hopper breaking?
    Retain-tweaked
    : false
    # If retain tweaked hoppers, should it only drop when mined with silk touch?
    Silk-only
    : true

    # Should the tweaked hopper drop into the player's inventory upon break or onto the world normally?
    # This should fix the problem of tweaked hoppers flying out after being broken.
    To-inv
    : false

    # Here you can set if player drops would be picked up by the hopper or not.
    Greedy-mode
    : false

    # To further reduce lag caused by farms, this forces the following types of farms
    # to only be able to work when a crop hopper is in the chunk.
    # Set to false to disable the farm type.
    Farm-tweaks
    :
     #This refers to the initial spawning of entities by spawners, not their death.
      Spawners
    :
        Allow
    : true
        #This allows specific types of spawners to still work under no crop hoppers.
        Whitelist
    :
         -
      #This refers to every farms using a piston to break the crop.
      Piston-farms
    :
        Allow
    : false
        #This blacklists the blocks you want pistons to not farm. Default is
        #Pumpkin, Melon and Sugarcane.
        Blacklist
    :
         - PUMPKIN
          - MELON_BLOCK
          - SUGAR_CANE_BLOCK
      #This refers to every farms using water to break the crop.
      Water-farms
    :
        Allow
    : true
        #This blacklists the blocks you want water to not flow and destroy. Default is
        #Potato, Carrot, Wheat and Nether warts.
        Blacklist
    :
         - POTATO
          - CARROT
          - CROPS
          - NETHER_WARTS
      #This refers to the conventional method of cactus breaking by adjacent block.
      Cactus-farms
    : true
     
    # Enable /converthopper cooldown?
    Cooldown
    :
      Enable
    : false
      Seconds
    : 30
     
    # You can rename the tweaked hopper here.
    Hopper-name
    : "&3Farming &fHopper"

    # You can set the lore of the tweaked hopper here.
    Hopper-lore
    :
     - "&7This hopper is special."
      - "&7It can find specific items"
      - "&7And teleport the items to it instantly."

    # Use economy? Vault API required
    Eco
    :
      Use
    : false
      Conversion-fee
    : 0.0
     
    Todo and known bugs

    Todo:
    - Add radius option instead of only one chunk
    - Your suggestions :p
    Known bugs:
    - players with existing hoppers cannot reconvert if the admins changed either the lore or the name only
    - when exception handling is fired, the item which fired the handling will not be picked up by the tweaked hoppers even if there is any in that affected chunk.

    Source code is now available on GitHub: https://github.com/despawningbone/HLR
    pinkpig and Tractors like this.

Recent Reviews

  1. Riknesh
    Riknesh
    4/5,
    Version: 1.3.2
    Great plugin...really helped reduce alot of lags caused by entities.

    But can you add the option to change/tweak to item transfer rate of the hoppers. Even though the hopper transfer rate in my spigot.yml is set to a fast rate, the crop hopper transfer rate is still the same. So can you add this option. THX
  2. Romain320
    Romain320
    3/5,
    Version: 1.3.1
    Hello i have one problemes [22:17:49] [Server thread/ERROR]: Could not pass event BlockPlaceEvent to HLR v1.2.2

    org.bukkit.event.EventException

    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[spigot-1.9.jar:git-Spigot-104c8c8-00d3334]

    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot-1.9.jar:git-Spigot-104c8c8-00d3334]

    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [spigot-1.9.jar:git-Spigot-104c8c8-00d3334]

    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [spigot-1.9.jar:git-Spigot-104c8c8-00d3334]

    at org.bukkit.craftbukkit.v1_9_R1.event.CraftEventFactory.callBlockPlaceEvent(CraftEventFactory.java:142) [spigot-1.9.jar:git-Spigot-104c8c8-00d3334]

    at net.minecraft.server.v1_9_R1.ItemStack.placeItem(ItemStack.java:159) [spigot-1.9.jar:git-Spigot-104c8c8-00d3334]

    at net.minecraft.server.v1_9_R1.PlayerInteractManager.a(PlayerInteractManager.java:522) [spigot-1.9.jar:git-Spigot-104c8c8-00d3334]

    at net.minecraft.server.v1_9_R1.PlayerConnection.a(PlayerConnection.java:888) [spigot-1.9.jar:git-Spigot-104c8c8-00d3334]

    at net.minecraft.server.v1_9_R1.PacketPlayInUseItem.a(SourceFile:55) [spigot-1.9.jar:git-Spigot-104c8c8-00d3334]

    at net.minecraft.server.v1_9_R1.PacketPlayInUseItem.a(SourceFile:11) [spigot-1.9.jar:git-Spigot-104c8c8-00d3334]

    at net.minecraft.server.v1_9_R1.PlayerConnectionUtils$1.run(SourceFile:13) [spigot-1.9.jar:git-Spigot-104c8c8-00d3334]

    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_72]

    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_72]

    at net.minecraft.server.v1_9_R1.SystemUtils.a(SourceFile:45) [spigot-1.9.jar:git-Spigot-104c8c8-00d3334]

    at net.minecraft.server.v1_9_R1.MinecraftServer.D(MinecraftServer.java:721) [spigot-1.9.jar:git-Spigot-104c8c8-00d3334]

    at net.minecraft.server.v1_9_R1.DedicatedServer.D(DedicatedServer.java:400) [spigot-1.9.jar:git-Spigot-104c8c8-00d3334]

    at net.minecraft.server.v1_9_R1.MinecraftServer.C(MinecraftServer.java:660) [spigot-1.9.jar:git-Spigot-104c8c8-00d3334]

    at net.minecraft.server.v1_9_R1.MinecraftServer.run(MinecraftServer.java:559) [spigot-1.9.jar:git-Spigot-104c8c8-00d3334]

    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_72]

    Caused by: java.lang.NoSuchMethodError: org.bukkit.event.block.BlockPlaceEvent.getHand()Lorg/bukkit/inventory/EquipmentSlot;

    at me.despawningbone.HLR.CHlistener.onBlockPlace(CHlistener.java:51) ~[?:?]

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_72]

    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_72]

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_72]

    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_72]

    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-1.9.jar:git-Spigot-104c8c8-00d3334]

    ... 18 more
    1. despawningbone
      Author's Response
      Posting requests for help here will not be entertained. Besides, this alone does not give enough info, and I cannot continue a message chain here.
      Therefore, please consider using the discussion thread instead, or even direct message me will be a much more viable option.
  3. Akakarumba
    Akakarumba
    5/5,
    Version: 1.3.1
    Thanks for the give command, and the speed of implementing it, whoaa.
    I can't wait to use it in my world!
  4. coolfire02
    coolfire02
    5/5,
    Version: 1.3.1
    The give command update. Absolutely spot on! This plugin has not been the most attractive but has been the most useful plugin out there! Especially for skyblock and now prisons :D
  5. Akakarumba
    Akakarumba
    5/5,
    Version: 1.3.0b
    Hey, really good job here, could you implement a function close to a /give chopper ?
    Would be very great for shop purpose.
  6. ogplayerfc
    ogplayerfc
    2/5,
    Version: 1.3.0b
    I would change it after Ill see improvement, this plugin seems to broke my redstone on my server, fix and ill change
    1. despawningbone
      Author's Response
      It would be nice if you have given me more details, and not in the review section. The only possible place where redstone might be affected is the tweaked hoppers itself, which in all my testings are all according to vanilla redstone, except for the collection part. Mind if you give me your plugin list, details about what redstone contraption has broken and how has it broken, instead of demanding a fix when I don't even have any information?
  7. jhonny112411
    jhonny112411
    4/5,
    Version: 1.3.0b
    Deff would be amazing if you could add a radius option soon. Been looking for this for a while. Also if you could add a way to change how many items the hopper passes on to the chest with a config would be amazing! Great plugin though!!
    1. despawningbone
      Author's Response
      From what I understand, the amount of items that the hopper passes on to the chest is configured in the bukkit configuration file globally, and not a value i can tweak. But for the radius, i will definitely think of ways to implement it, as it is also on my todo list for pretty long now :P
  8. Tractors
    Tractors
    5/5,
    Version: 1.3.0b
    Bloody awesome plugin! Theres no other here on spigot like it, may I recommend a command to give players hoppers though? You just specify their name and amount of Tweaked hoppers
  9. rubus8
    rubus8
    5/5,
    Version: 1.2.2
    Great plugin, no issues i have come across, all customizable. Keep up the good work
  10. coolfire02
    coolfire02
    5/5,
    Version: 1.2.2
    Excellent plugin! Found no flaws when I tried it! Hoppers arent as server consuming anymore! Really really awesome! Cant wait to see more of your future plugins! <3