Skip to content

Commit

Permalink
Fix custom filtering rule not being accessible by ZenCode
Browse files Browse the repository at this point in the history
NOTE: this is a temporary fix, it will not persist and will be reverted
when ZenCode gets a better handling of generic parameters after the
refactor.

Modders should not rely on these methods existing

Signed-off-by: TheSilkMiner <thesilkminer@outlook.com>
  • Loading branch information
TheSilkMiner authored and Witixin1512 committed Feb 24, 2024
1 parent 25d55fc commit f0574b5
Showing 1 changed file with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,43 @@ public static CustomFilteringRule of(final BiPredicate<IRecipeManager<?>, Recipe
return new CustomFilteringRule(predicate, true);
}

/**
* Creates a new rule filtering recipes based on the given {@link Predicate}.
*
* <p>The predicate gets access to the {@link Recipe} instance directly, allowing for it to check directly elements
* that might be required.</p>
*
* @param predicate The predicate for checking.
*
* @return A rule carrying out what has been specified.
*
* @since 11.0.0
*/
@ZenCodeType.Method("of")
public static CustomFilteringRule ofZen(final Predicate<Recipe<Container>> predicate) {

return of(GenericUtil.<Predicate<Recipe<?>>>uncheck(predicate));
}

/**
* Creates a new rule filtering recipes based on the given {@link BiPredicate}.
*
* <p>The predicate's first argument represents the {@link IRecipeManager} used by the recipe, whereas the second
* argument is the {@link Recipe} instance directly, allowing for it to check properties that might be required or
* perform additional manager-specific lookups.</p>
*
* @param predicate The predicate for checking.
*
* @return A rule carrying out what has been specified.
*
* @since 11.0.0
*/
@ZenCodeType.Method("of")
public static CustomFilteringRule ofZen(final BiPredicate<IRecipeManager<Recipe<Container>>, Recipe<Container>> predicate) {

return of(GenericUtil.<BiPredicate<IRecipeManager<?>, Recipe<?>>>uncheck(predicate));
}

@Override
public Stream<RecipeHolder<?>> castFilter(final Stream<RecipeHolder<?>> allRecipes) {

Expand Down

0 comments on commit f0574b5

Please sign in to comment.