Skip to content

Integrate upstream PR #132: eliminate anvil interaction freeze - #3

Merged
AzureTai merged 2 commits into
AzureTai:agent/process-upstream-prsfrom
Maeyanie:fix/anvil-tooltip-freeze
Aug 18, 2026
Merged

Integrate upstream PR #132: eliminate anvil interaction freeze#3
AzureTai merged 2 commits into
AzureTai:agent/process-upstream-prsfrom
Maeyanie:fix/anvil-tooltip-freeze

Conversation

@AzureTai

Copy link
Copy Markdown
Owner

Imports jayugg/SmithingPlus PR jayugg#132 after the client/server configuration split.

Original PR: jayugg#132
Original author: Maeyanie

Root cause addressed:

  • ItemStack material fallbacks bypass the collectible cache;
  • resolved negative material results are repeatedly recomputed;
  • smithing and grid recipes are scanned repeatedly for each candidate item.

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.

Maeyanie and others added 2 commits June 11, 2026 03:40
…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.
@AzureTai
AzureTai merged commit 567cc61 into AzureTai:agent/process-upstream-prs Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants