Interface ITargetingRule

All Known Implementing Classes:
EverythingTargetingRule, ExcludingManagersAndDelegatingTargetingRule, ExcludingModsAndDelegatingTargetingRule, ExcludingRecipesAndDelegatingTargetingRule, OutputTargetingRule, RegexTargetingRule, SpecificManagersTargetingRule, SpecificModsTargetingRule, SpecificRecipesTargetingRule, ZenTargetingRule

public interface ITargetingRule
Represents a rule used to identify which recipes should have their ingredients replaced by IReplacementRules.

Each targeting rule should be considered pure, which means it should not rely on external and/or global state to decide whether a recipe may be replaced or not. A targeting rule may in fact be queried multiple times for the same recipe.

  • Method Summary

    Modifier and Type
    Method
    Description
    Describes in a short and simple sentence the behavior of this rule.
    boolean
    shouldBeReplaced(net.minecraft.world.item.crafting.Recipe<?> recipe, IRecipeManager<?> manager)
    Indicates whether the given recipe should undergo ingredient replacement or not.
  • Method Details

    • shouldBeReplaced

      boolean shouldBeReplaced(net.minecraft.world.item.crafting.Recipe<?> recipe, IRecipeManager<?> manager)
      Indicates whether the given recipe should undergo ingredient replacement or not.

      Rules are allowed to check any aspect of the provided objects to validate the recipe, as long as the result remains consistent across multiple calls with the same objects.

      Parameters:
      recipe - The recipe to check for targeting.
      manager - The recipe manager that is responsible for the given recipe.
      Returns:
      Whether the given recipe should undergo ingredient replacement or not.
    • describe

      String describe()
      Describes in a short and simple sentence the behavior of this rule.
      Returns:
      The description of this rule.