Skip to content

Smart Filters

desht edited this page Jul 4, 2017 · 14 revisions

Contents

Overview

Filters are craftable items which can be inserted into a module's filter slots like any other item, but which have various sophisticated item matching functionality. Filters were added in v1.1.0 of Modular Routers.

Note that when a smart filter is added to a module, only a copy of that filter is added. That copy can be configured while installed (by middle-clicking it in the module's GUI, or pressing 'C' while the mouse is over it) and the original - real - filter item will not be affected. This means that in theory you only need one of each type of filter item (you can install the same item in multiple modules), but in practice it may be more convenient to have several of each.

There are currently four types of smart filter (more may be added in future):

Bulk Item Filter

This filter allows for high-performance matching of up to 54 different items, including NBT and Ore Dictionary matching (as of v1.2.0).

The Bulk Item Filter can be configured in several ways:

  1. Sneak+Right-click this filter against any inventory to merge a copy of that inventory's contents into the filter.
  2. Right-click the filter to open a GUI showing the items currently in the filter. You can add (copies of) items to the filter here, click items to remove them, or press the red 'X' button to clear the filter completely.
  3. When the filter is in a module that is in a router, you can open its GUI by middle-clicking it (or pressing 'C' over it). IF the module has a valid inventory targeted, two extra buttons appear on the GUI: a green '+' button to Merge the target inventory's items, and a blue '=' button to Load the target inventory's items (replacing the current filter's contents). This is particularly useful combined with a Sender Module for sorting systems, since the filter remembers what should be in an inventory.

Inspection Filter

This filter allows for matching of items by various miscellaneous integer properties of the item. The current inspections supported are:

  • For fluid container items (buckets, tanks...), the fluid level as a percentage.
  • For energy container items (batteries, powered tools...), the energy level as a percentage.
  • The highest enchantment level of enchantments on the item (can be used to filter out enchanted items, e.g. from a mob farm)
  • The durability of items (tools, weapons) as a percentage of the max durability.
  • For edible items, the food value as the number of half-shanks restored (e.g. steak has a value of 8).

For items which don't have the inspected property at all, the returned value will always be 0, e.g. a piece of cobblestone has a food value of 0.

This filter can be useful to automatically pull out damaged or discharged items for repair/recharging, etc.

Mod Filter

This filter allows for matching of items by the mod they belong to. Up to 6 mods can be added per installed filter.

  • Right-click the filter to open its GUI (or middle-click/C on a filter which is installed in a module).
  • Drop any item into the item slot in the top-left corner of the GUI. The item's mod name will be displayed to the right. Click the '+' button to add to the mod list below.
  • Click the red 'X' button to remove any mod from the list.
  • Vanilla items can be added too, and their "mod" will be shown as "Minecraft".

Regex Filter

This filter allows for matching of items with a regular expression against the item's displayed name. Regular expressions are very powerful, but take some learning to unlock their full potential. However, basic regex usage isn't too difficult. There are many websites with tutorial information on regular expressions, e.g. https://regexone.com/, http://www.rexegg.com/ ...

  • Right-click the filter to open its GUI (or middle-click a filter which is installed in a module).
  • Type any filter into the textfield at the top of the filter, and press Return or click the green '+' button. Your regex will be added to the list, assuming it's a legal regular expression. You can have up to 6 regular expressions in one filter.
  • Click the red 'X' next to any regex to remove it from the list.
  • Matches are case-insensitive.
  • Example: a regex of 'ore' will match any items with 'ore' in their name ("iron ore", "gold ore", "redstone ore"). Unfortunately, it will also match "Drill Core" (hi Ellpeck), but you can avoid this by using a regex of '\bore' - the '\b' sequence means match only at a word boundary. To be even more specific, you could use '\bore$', which also ensures that the string "ore" is at the end of the item name.
  • Example: configure a Player Module to extract from the player's main inventory, and put a regex filter containing '\bore' in the module. This can be used to extract any ores from your inventory, regardless of where you are, into your ore processing system; very handy if you're mining far from your base and you want ores that you've mined to be sent home immediately.
Clone this wiki locally