Class CustomFilteringRule

java.lang.Object
com.blamejared.crafttweaker.api.recipe.replacement.type.CustomFilteringRule
All Implemented Interfaces:
IFilteringRule, ITargetingFilter

@ZenRegister public final class CustomFilteringRule extends Object implements IFilteringRule
Filters recipes according to a custom set of rules.
Since:
10.0.0
  • Method Details

    • of

      public static CustomFilteringRule of(Predicate<net.minecraft.world.item.crafting.Recipe<?>> predicate)
      Creates a new rule filtering recipes based on the given Predicate.

      The predicate gets access to the Recipe instance directly, allowing for it to check directly elements that might be required.

      Parameters:
      predicate - The predicate for checking.
      Returns:
      A rule carrying out what has been specified.
      Since:
      10.0.0
    • of

      public static CustomFilteringRule of(BiPredicate<IRecipeManager<?>,net.minecraft.world.item.crafting.Recipe<?>> predicate)
      Creates a new rule filtering recipes based on the given BiPredicate.

      The predicate's first argument represents the IRecipeManager used by the recipe, whereas the second argument is the Recipe instance directly, allowing for it to check properties that might be required or perform additional manager-specific lookups.

      Parameters:
      predicate - The predicate for checking.
      Returns:
      A rule carrying out what has been specified.
      Since:
      10.0.0
    • ofZen

      public static CustomFilteringRule ofZen(Predicate<net.minecraft.world.item.crafting.Recipe<net.minecraft.world.Container>> predicate)
      Creates a new rule filtering recipes based on the given Predicate.

      The predicate gets access to the Recipe instance directly, allowing for it to check directly elements that might be required.

      Parameters:
      predicate - The predicate for checking.
      Returns:
      A rule carrying out what has been specified.
      Since:
      11.0.0
    • ofZen

      public static CustomFilteringRule ofZen(BiPredicate<IRecipeManager<net.minecraft.world.item.crafting.Recipe<net.minecraft.world.Container>>,net.minecraft.world.item.crafting.Recipe<net.minecraft.world.Container>> predicate)
      Creates a new rule filtering recipes based on the given BiPredicate.

      The predicate's first argument represents the IRecipeManager used by the recipe, whereas the second argument is the Recipe instance directly, allowing for it to check properties that might be required or perform additional manager-specific lookups.

      Parameters:
      predicate - The predicate for checking.
      Returns:
      A rule carrying out what has been specified.
      Since:
      11.0.0
    • castFilter

      public Stream<? extends net.minecraft.world.item.crafting.Recipe<?>> castFilter(Stream<? extends net.minecraft.world.item.crafting.Recipe<?>> allRecipes)
      Description copied from interface: ITargetingFilter
      Casts the filter onto the given Stream of Recipes.

      The filter can perform any operation required, which range from filtering, to simple mapping, to peeking as needed.

      Specified by:
      castFilter in interface ITargetingFilter
      Parameters:
      allRecipes - The Stream that needs to be filtered.
      Returns:
      The mutated stream.
    • describe

      public String describe()
      Description copied from interface: IFilteringRule
      Describes the actions of this filtering rule in a human-readable form, for log output.
      Specified by:
      describe in interface IFilteringRule
      Returns:
      A human-readable description of this rule.