Skip to content

Pipe Filters

CD4017BE edited this page Nov 5, 2018 · 4 revisions

Pipe Filters can be attached to the different types of Basic Pipes (except Transport Pipes) as well as to their corresponding connectors on Advanced Universal Pipes. Item Pipe Filters are also used in the Portable Inventory Remote Access.

There are currently 5 different types of Pipe Filters that discriminate resources based on different properties:

  • basic Pipe Item-Filter checks whether an item matches with a list of specific items. (Item Pipes only)
  • basic Pipe Fluid-Filter checks whether an item matches with a list of specific fluids. (Fluid Pipes only)
  • Pipe Item-Content-Filter checks whether an item has a certain amount durability left or a certain amount energy or fluid stored inside. (Item Pipes only)
  • Pipe Name/ID-Filter checks whether a resource matches a certain name pattern. (both Item & Fluid)
  • Pipe Quantity-Filter provides special control over the amount of resource to be transfered. (both Item & Fluid)

All filters have some settings in common, that are: redstone control, blocking mode and connector priority.

Redstone Control

This setting allows disabling the pipe that has this filter attached based on the Redstone signal the block receives.
Disabling a pipe this way means it won't exchange any resources with neighboring inventories anymore. Transfer within the pipe network it is connected to, is not affected however.

Blocking Mode

This setting is typically called keep matching resources here when enabled and send further if can't insert when disabled. It controls how pipes should handle the case where a resource matches the filter but for whatever reason can't be (fully) inserted into the connected inventory.

Normally in such a situation Injection Pipes would just pass the resource on to the next pipe down the line. But if blocking is enabled, it would instead hold it in place and later try to insert it again (until insertion eventually succeeds). So blocking essentially guarantees that matching resources will never get any further than to this pipe.

Pipe Item/Fluid-Filter

The Pipe Item-Filter and Pipe Fluid-Filter are probably the filter types to use in most situations.
They compare resources to a user specified set of Items (or Fluids) and let them pass if they do or do not match (depending on the white/black-list setting) to any of them.

The Item Filter variant also supports fuzzy compare modes for damage and NBT to specify that the items' NBT tag and/or damage value should be ignored for comparison.
Note: Some items use the damage value for different things than durability.

Stock-keeping

Both Pipe Item-Filter and Pipe Fluid-Filter support a stock-keeping mode that, when enabled, ensures that an inventory only gets filled up to a certain amount of resources or in case of extraction that a certain amount of resources is left over in the inventory.

In the Pipe Fluid-Filter this mode is enabled by setting the stock-keeping amount to a value greater than zero and it will then aim to hold the combined fluid amount of all fluids in a target inventory at the specified amount of Buckets (it is possible to set amounts smaller than a full Bucket by typing 0.001 or similar).

In the Pipe Item-Filter it is enabled by a dedicated button and it will then aim to hold each item stack in a target inventory at the stack size of its corresponding item in the filter's compare set. Items that don't have a match in the filter's compare set, are either not let through at all in white-list mode or let through with unrestricted amount in black-list mode.

Pipe Name/ID-Filter

The Pipe Name/ID-Filter sorts items and fluids by their name, by comparing their name as it is displayed (assuming the server uses the same localization as your client) with the regular expression you specified in the filter. Depending on setting, your expression must either fully match the name or just be contained in it.

Resource ID mode

The filter can be switched into resource-ID mode, in which in won't use the displayed name but instead a resource-ID that is build up for items as <modId>:<itemId>,
where <modId> is the id of the mod adding the item and <itemId> is the textual id the item is registered with (press F3+H to have these ids displayed in item tool-tips).
If the item has multiple variants that share the same id but distinguish via damage value (like coal/charcoal for ex.), then this construct is suffixed by #<meta> with <meta> being the "damage" value.

For fluids this resource id is just the textual fluid id (usually just the English name in lowercase).

This mode is mostly useful if you want to sort items by their mod: using for ex. minecraft:.+ to match all vanilla items or indlog:.+ for Inductive Logistics items (the suffix :.+ ensures that we match against the mod id and not the item id).
This mode also has the advantage that it doesn't dependent on the localization that is used.

Regular Expressions

For text matching the filter uses regular expressions as specified here under section Summary of regular-expression constructs. A more convenient short summary of what the individual control characters do, can be also found in the documentation tab of the filter's GUI.

You don't need to bother about regular expressions in order to use the filter (as long as you're not accidentally using any of these control symbols), however the additional possibilities they offer are often quite useful as for example:
Helm|Chestp|Legg|Boots could be used to sort out all armor items (except leather because they are unfortunately named a bit different).

Config Settings

The following properties can be tweaked via config:

  • name_filter_chars specifies the maximum length of the regular expression that can be entered into the text field, default is 24 characters. This indirectly limits the complexity of discriminations that could be performed with this filter.

Pipe Quantity-Filter

Unlike the other filter types, the Quantity Filter does not discriminate resources but instead controls the stack size in which resources are moved around.

During extraction, first only resources are chosen that are available in high enough quantity to satisfy the specified stack size. Exactly the specified stack size of that resource is then extracted.
If however none of such resources can be found then either the resource with highest amount is extracted in exactly that amount or if the enforce stack size mode is enabled then nothing is extracted.

During injection the specified amount of the resource to inject is split off and attempted to be inserted into the target inventory while the remainder is passed on. However, if the target inventory doesn't accept the full amount offered to it and the enforce stack size mode is enabled then no transfer happens and the resource is also not passed on.
Note: Advanced Universal Pipes don't have an internal storage for resources so in this case the remainder resource would be returned to the sender inventory (meaning not extracted in the first place).

Even distribution

This type of filter is very useful in cases where you want to distribute resources evenly (or at a fixed ratio) over multiple destinations.

To distribute resources from source X across the destinations A and B at the ratio a:b, first attach a Quantity-Filter on the extraction pipe at X which is set to an amount of a + b with enforce stack size enabled.
Next let the pipe pass A with an injection pipe and attach a Quantity-Filter set to amount a (also enforce stack size enabled).
Finally complete the pipe, letting it end at B with an unfiltered injection pipe.

Notes:

  • This setup only delivers two destinations, extending this to N destinations is trivial and therefore left as an easy exercise for the reader.
  • The described setup uses Basic Pipes but it should also work with Advanced Universal Pipes in provider mode. Keep in mind that you also need to set the priorities to achieve correct order.
  • As the strict mode here represents the usual blocking mode, enabling it will also enable priority skipping on Universal Pipe extractors. To account for this, set the priority to 127 (or any priority higher or equal to those set on the destination filters).
  • The Universal Pipes variant may fail to maintain exact ratio in case some destinations are full.

Clone this wiki locally