Class RecipeFilterContext
java.lang.Object
com.portingdeadmods.researchd.api.RecipeFilterContext
Thread-local stack of who called frames pushed around code paths that
may invoke recipe lookups. The
RecipeManagerMixin
reads the current frame and filters out recipes blocked for that team.
Pushers (in core): BoundTickingBlockEntityMixin for every ticking BE,
CraftingMenuMixin for player crafting. Addons may push their own
frames for code paths that don't tick through a BE.
Addons that need to filter recipe lookups which bypass the vanilla
RecipeManager (e.g. mods with their own cached recipe
finders) should not re-implement the blocking rules. Instead they mixin into the foreign finder
and call isBlocked(RecipeHolder) per result, and, if that finder caches a prebuilt
structure, scope its cache key with scopedKey(Object) so each team keeps its own entry.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable RecipeFilterContext.Framecurrent()static booleanisBlocked(net.minecraft.world.item.crafting.RecipeHolder<?> holder) static booleanisBlocked(net.minecraft.world.item.crafting.RecipeHolder<?> holder, RecipeFilterContext.Frame frame) Single source of truth for whether a recipe is blocked for a given frame: the recipe id is blocked, or its result / any of its ingredients is a blocked item.static voidpop()static voidstatic ObjectScopes a foreign cache key to the current frame's team, so addon finders that cache a prebuilt structure (filtered recipe lists, tries, ...) keep a separate entry per team instead of letting whichever team searched first decide the result for everyone.
-
Method Details
-
push
-
pop
public static void pop() -
current
-
isBlocked
public static boolean isBlocked(net.minecraft.world.item.crafting.RecipeHolder<?> holder) - Returns:
trueifholderis blocked for the team of the current frame. Returnsfalsewhen there is no active frame (no filtering in progress).
-
isBlocked
public static boolean isBlocked(net.minecraft.world.item.crafting.RecipeHolder<?> holder, RecipeFilterContext.Frame frame) Single source of truth for whether a recipe is blocked for a given frame: the recipe id is blocked, or its result / any of its ingredients is a blocked item. -
scopedKey
Scopes a foreign cache key to the current frame's team, so addon finders that cache a prebuilt structure (filtered recipe lists, tries, ...) keep a separate entry per team instead of letting whichever team searched first decide the result for everyone.- Returns:
- a team-scoped key while a frame is active, otherwise
delegateunchanged.
-