Setting transfer limits - umnikos/hopper.lua GitHub Wiki

If you want to use hopper.lua to simply keep some chests stocked, or to keep some chests from overflowing, or for a bunch of other reasons, you might want to set a limit on how many items hopper.lua will attempt to transfer.

There are five types of limits:

  • -from_limit [number]/-from_limit_min [number] - Sets a minimum amount of items to keep in the item source, will only take when there's more items than this
  • -from_limit_max [number] - If the source contains more items than the specified number then nothing will be transferred
  • -to_limit [number]/-to_limit_max [number] - Sets a maximum amount of items to send to the item destination, will only send when there's less items than this
  • -to_limit_min [number] - If the destination contains less items than the specified number then nothing will be transferred
  • -transfer_limit [number] - Sets a limit on how many items can be transferred per iteration, paired with -sleep this can be used for rate limiting

The above descriptions are vague on what "the source" and "the destination" are, but that's because this part is configurable as well. By default all matching items in all slots in all the source chests count towards a single unified "number of items" for -from_limit to use, but that is not always what you want. The following flags specify other possibilities, and are to be placed after the limit they refer to:

  • -per_chest - Keeps a separate count for every chest
  • -per_slot - Keeps a separate count for every slot
  • -per_slot_number - Keeps a separate count for every slot number (-per_slot is equivalent to -per_chest -per_slot_number)
  • -per_item - Keeps a separate count for every item name (ignoring nbt)
  • -per_nbt - Like -per_item but also considers nbt

Multiple of these may be specified for a single limit, for example -per_chest -per_item will keep a separate count for every item type in every chest.

Multiple limits may also be specified (even multiple of the same type), in which case hopper.lua will try to satisfy all of them.

An additional option is -count_all, which will include items that did not match the filters into the limit count. Sometimes useful for very complicated logic.


hopper *barrel* *dispenser* *arrow* -to_limit 20 -per_chest - Keeps dispensers stocked with arrows from a central set of stock barrels. The amount of arrows per dispenser is kept low in order to not have stacks upon stacks of arrows stuck in potentially unused dispensers.

hopper *chest* *dropper* *cobblestone* -from_limit 150*64 -per_item -sleep 60 - When connected to some storage system of chests that has more than 150 stacks of cobblestone in it, it will start piping some of that cobblestone to a dropper for disposal purposes. This ensures the storage system won't overflow with cobblestone if you have some quarry connected to it, but that you also don't just throw away all of the cobblestone in case you need some. Since latency isn't important to this operation and your storage may be huge, a delay of 60 seconds ensures this command doesn't cause much lag.

hopper top bottom *diamond* -transfer_limit 1 -sleep 10*60 - This will transfer a single diamond from the top chest to the bottom chest roughly every 10 minutes. If the chest on the bottom is publicly accessible and the top one is not this can be used as a sort of giveaway system

hopper *chest* *shulker* -refill - -refill is an alias for -to_limit_min 1 -per_chest -per_item. This command will essentially sort everything from the chests into shulker boxes without having to specify a bunch of filters.

hopper *chest* *manipulator* -refill -to_limit 32 -per_item - This is a simple command to refill your inventory with supplies from a central chest but only with things that you are currently using (aka. things in your inventory). Useful when building.

hopper *manipulator* *chest* -from_limit_max 10 -per_item -to_limit_min 1 -per_item - This is a command to automatically clean your inventory of random mob drops. What a "mob drop" is is defined by the -to_limit_min; A mob drop is any item that there's already some of in the mob drops chest. The -from_limit_max ensures it only hoppers away small amounts of loot that you just picked up and not large amounts that you took out from a chest and are attempting to transport or craft with.

hopper *chest* *shulker* -to_limit_min 1 -per_slot_number -to_limit 16 -per_slot - This is a command to ease filling shulker boxes with items in a particular arrangement. As long as one correctly filled box is connected, the rest of the boxes will only receive items in the correct slots, although not necessarily in the same amounts as in the example box. The -to_limit restricts each slot to only having a maximum of 16 items for aesthetic purposes.