Integrate upstream PR #132: eliminate anvil interaction freeze - #3
Merged
AzureTai merged 2 commits intoAug 18, 2026
Merged
Conversation
…dlists BlockAnvil.GetPlacedBlockInteractionHelp queries GetRequiredAnvilTier for every handbook stack of every IAnvilWorkable item. With CollectibleBehaviorCastToolHead attached to everything matching ToolHeadSelector, each query resolved the metal material from scratch: - The ItemStack overload of GetOrCacheMetalMaterial bypassed the material cache for all behavior-based workables (any collectible whose class is not IAnvilWorkable), calling the uncached resolver every time. - Failed resolutions (null) were never cached, so items with no metal material re-ran the full fallback on every call. - The fallback linearly scanned all smithing recipes and all grid recipes x ingredients per call. Fix: route both fallback paths of the ItemStack overload through the collectible-level cache; cache negative results once MetalMaterialLoader has resolved its materials (new MaterialsResolved flag prevents premature nulls from poisoning the cache); and replace the linear recipe scans in GetSmithingRecipe, GetSmithingRecipesAsIngredient and GetGridRecipesAsIngredient with one-time reverse indexes keyed by collectible code, built lazily via ObjectCacheUtil. On a large modlist this cuts the first anvil tooltip from ~2 minutes of freeze to ~200 ms. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add comment suggested by coderabbitai.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Imports jayugg/SmithingPlus PR jayugg#132 after the client/server configuration split.
Original PR: jayugg#132
Original author: Maeyanie
Root cause addressed:
The imported change adds reverse recipe indexes, routes fallbacks through caching, and guards negative caching until material resolution has completed.
The source will receive a subsequent standards and lifecycle audit before the compile/test gate.