Skip to main content

Minecraft Hopper filter

Minecraft hopper filter earthmc

The hopper filter allows you to specify which items are allowed to pass through based on name patterns, tags, and item properties. Renaming a hopper applies the filter.

note

Hopplet is open-source and made by Fruitloopins.

Creating a hopper filter

The only way to create a filter is through a dialog. With no item in your main hand, sneak and right-click a hopper or hopper minecart as though you were going to open it to view its contents. If you have permission to edit this hopper, an interface will open that looks like this:

Dialog preview

This system also allows you to check if the filter is written correctly (we will provide examples for filters below) using "Validate" button. If something goes wrong, it will tell you what the issue is, otherwise, you're good to go!

Functions

Hopper filter heavily relies on functions to be able to filter items in a detailed matter. All functions require to use "function(args)" format, where "function" is the function name and "args" is the specified filter of your choice. Some functions also require the use of " for their proper functioning (it is preferred to use quotation for all filters).

Function NameDescriptionUsage
amount/sizeChecks if an item stack's size matches all the specified amounts.amount(>32, <48)
trim_materialChecks if an item's armor trim material matches one of the specified materials.trim_material(gold)
trim_patternChecks if an item's armor trim pattern matches one of the specified patterns.trim_pattern(silence)
book_authorFilters books made by the specified author.author(Veyronity)
book_generationFilters books of the specified generation.generation(copy_of_copy)
nameOnly accepts items with an exact name. (Ignores name color)name("Super Secret Access Key")
name_starts_withAccepts items starting with a specified string.name_starts_with(mossy, diamond)
name_containsAccepts items containing specified string.name_contains(stone, moss)
name_ends_withAccepts items ending with a specified string.name_ends_with(map)
durabilityFilters tools and armor of specified state (damage severity).durability(max, undamaged), durability(>=90)
enchantmentFilters tools and armor containing specified enchantments.ench("sharpness >= 4", fire_aspect)
is_trimmedOnly accepts trimmed armor.trimmed()
is_foodOnly accepts edible items (food).edible()
is_enchantedOnly accepts enchanted items.enchanted()
is_fuelOnly accepts items usable as fuel in a furnace.fuel()
is_repairableOnly accepts repairable in an anvil items.repairable()
is_smeltableOnly accepts smeltable items.smeltable()
is_stackableOnly accepts stackable items.stackable()
is_unbreakableOnly accepts unbreakable items (items with "unbreakable" line in the description).unbreakable()
materialFilters items of a specified material.type(cobblestone, mossy_cobblestone)
material_starts_withFilters items starting with a specified material name.type_starts_with(diamond, iron)
material_containsFilters items containing specified material name.type_contains(stone)
material_ends_withFilters items ending with a specified material name.type_ends_with(e)
potion_durationChecks if a potion has all the specified durations in ticks.duration(>=3600), duration(infinite, unlimited), duration(3600)
potion_effectChecks if a potion has all the specified potion effects.effect("speed = 2", invisibility, instant_health>=1)
source_inventory_typeChecks if an item's source is of one of the specified types.source(barrel)
rarityChecks if an item matches one of the specified item rarities.rarity(common)
smeltable_byChecks if an item can be smelted in one of the specified furnace types.smeltable_by(smoker, blast_furnace)
tagChecks if an item or a block contains one of the specified tags.tag(wool), tag(beds)
thrown_byChecks if an item was thrown by one of the specified UUIDs or usernames.thrower(Fruitloopins, 12BarBruise), thrown_by(fed0ec4a-f1ad-4b97-9443-876391668b34)

Syntax

That allows you to customize how the functions themselves behave as all of them accept items with specified properties by default.

SyntaxDescriptionExample
function(args)Standard look of a filter/function.type(diamond), name("Secret Item")
&Two or more conditions must all be true.type(diamond_sword) & ench(sharpness)
|Any of two or more conditions must be true.type(gold_ingot) | thrower(Fruitloopins)
!Negates a statement.!enchanted()
()Defines an expression to be evaluated separately.type(gold_ingot) | (author(Fruitloopins) & generation(copy_of_copy))
"Indicates that an argument should be treated as a literal string including spaces. Recommended to use for all arguments.ench("sharpness >= 4")

Usage Examples

Hopplet Usage Example 1

That filter will only accept items thrown by K1kimor OR golden ingots.

Hopplet Usage Example 2

That filter will accept any log or wood variant with a few nether related blocks.

Hopplet Usage Example 3

That filter will only accept haste 8 potions.

Hopplet Usage Example 4

Hopper filter also supports multiple lines for readability! This filter accepts gold blocks OR any copy of the copy written book authored by K1kimor.

Quirks to be aware of

Item movement when two hoppers are connected to the same source hopper

If a hopper pulling an item doesn't have a filter, the server checks if there's another hopper connected to the original source hopper that does have a filter. If there is, and that hopper's filter matches the item being moved, the server cancels the original movement to the filterless hopper. Instead, the item will go into the hopper with a filter active.

First slot only

It is important to note that vanilla Minecraft only attempts moving items from the first slot in an inventory. Hopplet does not intervene if the item in the first slot has nowhere to go, as that would create hard to understand, undefined behaviour. Players designing a filtering system are expected to give invalid items a path to go, for example a "dump" of unfiltered hoppers leading into chests at the end of your storage room. An example is a continuously connected brewer system where the stands get filled up with newer potions before getting their existing potions dumped, creating a "jam".

Broken Filter

If your filter is wrongfully done (applied filter without validation), on EarthMC it will not accept any items instead of defaulting to normal hopper behavior. That allows players to pinpoint the malfunctioning filter faster.

Hopper jamming

It is important to ensure your hoppers don't get jammed by an item in the first position of a hopper. You should always have a standard hopper for unwanted items to exit through to prevent items jamming your setup that can't pass a filter.⏎