Skip to content

Hopper Filters (Better With Mods)

Description

Items placed in the middle slot of the Filtered Hopper to restrict what is capable of passing through.

Identifier

Refer to this via any of the following:

groovy
mods.betterwithmods.hopper_filters/* Used as page default */
mods.betterwithmods.hopperfilters
mods.betterwithmods.hopperFilters
mods.betterwithmods.HopperFilters

Adding Recipes

Recipe Builder

Just like other recipe types, the Hopper Filters also uses a recipe builder.

Don't know what a builder is? Check the builder info page out.

mods.betterwithmods.hopper_filters.recipeBuilder()
  • IngredientList<IIngredient>. Sets the valid items allowed through the filter. Requires greater than or equal to 0 and less than or equal to Integer.MAX_VALUE.

    groovy
    input(IIngredient)
    input(IIngredient...)
    input(Collection<IIngredient>)
  • IIngredient. Sets the filter itemstack. Requires not null.

    groovy
    filter(IIngredient)
  • First validates the builder, returning null and outputting errors to the log file if the validation failed, then registers the builder and returns the registered object. (returns null or betterwithmods.api.tile.IHopperFilter).

    groovy
    register()
Example
groovy
mods.betterwithmods.hopper_filters.recipeBuilder()
    .name('too_weak_to_stop')
    .filter(item('minecraft:string'))
    .register()

mods.betterwithmods.hopper_filters.recipeBuilder()
    .name('groovyscript:clay_only')
    .filter(item('minecraft:clay'))
    .input(item('minecraft:clay'))
    .register()

Removing Recipes

  • Removes all filters with the given filter item:

    groovy
    mods.betterwithmods.hopper_filters.removeByFilter(IIngredient)
  • Removes all filters with the given items allowed through the filter:

    groovy
    mods.betterwithmods.hopper_filters.removeByFiltered(IIngredient)
  • Removes the filter with the given name:

    groovy
    mods.betterwithmods.hopper_filters.removeByName(String)
  • Removes all registered recipes:

    groovy
    mods.betterwithmods.hopper_filters.removeAll()
Example
groovy
mods.betterwithmods.hopper_filters.removeByFilter(item('minecraft:trapdoor'))
mods.betterwithmods.hopper_filters.removeByName('betterwithmods:ladder')
mods.betterwithmods.hopper_filters.removeAll()

Getting the value of recipes

  • Iterates through every entry in the registry, with the ability to call remove on any element to remove it:

    groovy
    mods.betterwithmods.hopper_filters.streamRecipes()

© 2024 CleanroomMC. All Rights Reserved.