SANDBOX — this is a test environment. No servers are actually deployed and no real payments are charged.
Source-checkedQuality of life & UI

StackmasterFix

by s6652289 · for Valheim

[AI-generated] Two client-only patches for Stackmaster 1.2.0: (A) Quick Grab Materials never debited chests (duplication); (B) its new remembered-chest fallback refills chests you just emptied (intentional upstream, not a bug) - disabled.

212Downloads
57d agoLast updated
BepInExLoaders
ThunderstoreSource

About StackmasterFix

From Thunderstore

[AI-generated] Two client-only patches for Stackmaster 1.2.0: (A) Quick Grab Materials never debited chests (duplication); (B) its new remembered-chest fallback refills chests you just emptied (intentional upstream, not a bug) - disabled.

StackmasterFix

适用性声明 / Applicability Notice

中文:本模组是给第三方模组 JStack424-Stackmaster 打的客户端补丁,含两个互相独立的修复项:

| 项 | 内容 | 性质 | |---|---|---| | A | 建造菜单 Alt + 左键(上游叫 Quick Grab Materials)拉取一整套材料时,箱子里的材料不扣减(等于复制) | 是 bug(在上游 1.2.0 上依然存在) | | B | 上游 1.2.0 新增的「记住上次直接用过的箱子」回退:你把某个箱子清空后,在别处按 Alt + E(Quick Stack),刚取出来的东西会被原样塞回那个空箱 | 不是 bug,是上游有意做的特性(见下) |

⚠️ 关于 B 项:这不是原模组的 bug,只是我个人的偏好开关

上游 1.2.0 的 changelog 明写这是有意添加的功能 —— 「Quick Stack remembers the last directly observed chest for each exact item type, even after that chest reaches zero stock」,目的是方便"补货": 你有个装木材的箱子、把它用空了,下次快速堆叠时木材会自动回到那个箱子。

我认为"被我清空的箱子就应该保持空着",所以用 DisableRememberedChests 这个开关把它关掉。 这只是个人习惯,不代表上游做错了。如果你觉得上游的行为挺好,请不要用本补丁, 或者把该开关设成 false 即可原样恢复上游行为。

  • 这个 A 项 bug 是在我这台装了 30+ 模组、且以客机身份连远程专用服务器的环境里复现并定位的。

原模组作者与这些问题无关,有疑问请先找我,不要去找原作者。

  • 原模组在别的环境下可能并没有 A 项这个 bug,症状也可能是我这台的特定组合导致;

不保证适用于你的环境。

  • 本补丁只做这两件事:

A:把扣减从「只读快照副本」改到「真实容器」,并在事务成功后强制写回 ZDO; B:把上游那张「记忆箱子」回退表的返回值换成空表,让回退永不触发。 不改任何数值、不动上游的记忆存档数据、不加任何新功能。

  • 本补丁未经原作者同意或审阅,也不主张任何「原模组有 bug」的结论(A 项除外,那一项我给了 IL 证据)——

整体上只是我这台机器上的绕行方案。

  • 若上游之后自己修好了 A 项,请优先升级上游模组并停用本补丁;

若你喜欢上游 B 项的行为,把 DisableRememberedChests 设为 false 即可。

English: This is a client-side patch for the third-party mod JStack424-Stackmaster, with two independent fixes:

  • A|Quick Grab Materials did not consume materials (Alt + left-click a build piece):

chests were never debited, i.e. item duplication.

  • B|Quick Stack put items back into a chest you just emptied: Stackmaster 1.2.0 introduced

"remember the last directly observed chest" as a fallback destination.

⚠️ B is NOT a bug in the original mod. The upstream 1.2.0 changelog states this behaviour is intentional ("even after that chest reaches zero stock", to make restocking convenient). This patch merely turns that feature off because I personally prefer an emptied chest to stay empty. If you like the upstream behaviour, do not use this patch, or set DisableRememberedChests = false to restore it exactly.

  • The A bug was reproduced and diagnosed on my setup: a 30+ mod client connecting to a

remote dedicated server. The original mod's author is not responsible for any of this.

  • The original mod may be perfectly fine in your setup; this patch is not guaranteed to apply to you.
  • The patch only (A) redirects the withdrawal from a read-only snapshot copy to the live container and

forces the container's ZDO write after a successful transaction, and (B) returns an empty map for the remembered-chest fallback. It changes no values, never touches the stored memory data, and adds no features.

  • This patch is not endorsed or reviewed by the original author, and makes no claim that the

original mod is buggy (except item A, for which IL evidence is given) — it is a "works-on-my-machine" workaround.

  • If upstream fixes item A, update Stackmaster and disable this patch. If you like upstream's

item B behaviour, set DisableRememberedChests = false.

> 🤖 本模组的代码由 AI 生成(AI Generated),需求、验证与发布由人类完成。


v1.2.0:新增「拦截记忆箱子回退」(B 项)

症状:把一个箱子里的东西取空 → 走到别的箱子按 Alt + E 快速堆叠 → 刚取出来的东西又被塞回那个空箱子。

根因(对 Stackmaster.dll 1.2.0 反汇编核对,316,416 B / sha256 be2fc8941b1abd96…):

  1. 上游 1.2.0 新增了 RememberedChestDestinations:只要你直接打开/对准过某个箱子,

就按"物品种类"把它记进本地 PlayerPrefs(上限 512 条、180 天过期)。 箱子被清空也不会抹掉这条记忆 —— 这是 changelog 里明写的有意设计。

  1. 正常堆叠只进"当前已经装有同类物品"的箱子,不会主动填空箱:

<>c__DisplayClass2_0::<PlanDeposits>b__1 的整个筛选逻辑就是 container.InitialCompatibilityKeys.Contains(source.CompatibilityKey) ⇒ 空箱子的候选键集合为空,永远进不了正常候选列表。

  1. 于是有了「回退」这条路(StorageTransferPlanner.PlanDeposits,IL 0x00FF-0x014A):

当剩余量 > 0 且本次一件都没搬走、且 remembered.TryGetValue(stackId, out containerId) 命中、且该箱子在当前发现范围内 ⇒ 把这一份放进那个箱子。 ⇒ 回退只可能发生在"这个箱子当前一件同类物品都没有"的时候。

修法:在 IReadOnlyDictionary<string,string> Stackmaster.RememberedChestDestinations.ResolveFallbacks( Player, InventorySnapshot, DiscoveryResult) 上打一个 Postfix,把返回的 StackId → ContainerId 回退表换成空表 ⇒ PlanDeposits 里的 TryGetValue 永远 miss ⇒ 回退永不触发。

影响面为什么是封闭的(scripts/verify_stackmasterfix.py 每次交付前自动核这四条):

| 核对项 | 实测结论 | |---|---| | ResolveFallbacks 全 DLL 调用点 | 只有 2 个:StorageAction.Begin 与 <FinishAfterOwnership>d__17.MoveNext —— 都是 Quick Stack 存料路径 | | 记忆数据的读取点 RememberedDestinationState::TryGet | 只被 ResolveFallbacks 调用 1 次 ⇒ 在返回值上拦截即完全封闭 | | 是否影响合成扣料 / 快速取料(A 项) | 不影响,那是另外的类(NearbyResources / QuickGrabMaterialsAction) | | 目标签名 | 参数 3 个、返回类型恰为 IReadOnlyDictionary<string,string>,与 Postfix 的 ref 参数一字不差 |

刻意不做的事:

  • 不改上游的记忆存档(ObserveDirect / PlayerPrefs 原样保留)。

⇒ 本修复完全可逆:把 DisableRememberedChests 设成 false 立刻恢复上游行为,不用重建记忆。

  • 不碰"失败堆叠标红框"那套(FailedDepositWarnings)。

⚠️ 需要知道的副作用:上游 1.2.0 会对「合格但最终留在背包里」的物品临时打 !数量 红框 (悬浮该物品一次即清除)。本修复让这部分物品真的留在背包里 ⇒ 红框出现的机会比以前多一点。 这是上游既有的提示机制,不是本补丁引入的新行为 —— 在离家老远、附近没箱子时按 Alt+E 本来就会满屏红框。

配置:

| 键 | 默认 | 说明 | |---|---|---| | DisableRememberedChests | true | 关掉「记忆箱子」回退。设 false = 完全恢复上游 1.2.0 行为。 |

> 新增配置节后需要重启游戏才会写出该节。


⚠️ v1.1.0:合成/升级那半已剔除

Stackmaster 1.1.5 自己修好了「用箱子材料合成/升级不扣料」。 依据:

  • 1.1.5 changelog 首条即声明该修复(`… recaptured from each selected owned Container.GetInventory()

rather than from detached ZDO inventory snapshots …`),并写明已在游戏内验证。

  • 源码层面,NearbyResourceService 在执行期改用活库存重建 runtime stack

(NearbyResources.cs:1288 取 Container.GetInventory(),:1294-1313 用它重建 handle), 并在扣减前用 ReferenceEquals(runtime.Inventory, runtime.Container.Container.GetInventory()) 做 fail-closed 身份校验(:1673-1681),另配精确扣减账本与逆序回滚。

⇒ 本补丁原先针对 ExecuteWithRollback 的 transpiler 已退化为恒等替换, 故 1.1.0 连同 FixCraftingFromStorage 配置项一起删除。

Read the full description on Thunderstore →

Highlights

From source data

Loaders

Runs on BepInEx.

Footprint

Rated a light load on a server.

Last update

Its author last shipped an update 57d ago.

StackmasterFix on Nxeon

From our catalogue
One-click install
Supported on Nxeon Valheim servers, for BepInEx servers. We download it from Thunderstore, place it, and restart the server.
Server type needed
BepInEx
Server load
light
Smallest plan we suggest
Valheim — 2 GB (2 GB RAM). This follows our own load rating above, not a benchmark.
Latest build
1.2.0, released 2026-09-26

Game versions by loader

LoaderGame versionsNewest
BepInEx

From 4 recorded builds of StackmasterFix.

Recent builds

BuildReleasedGame versionsLoaders
1.2.02026-09-26n/aBepInEx
1.1.12026-09-25n/aBepInEx
1.1.02026-09-22n/aBepInEx
1.0.02026-09-19n/aBepInEx

Dependencies

Declared by the newest build that lists any. Required ones are installed with it on one-click installs.

Run StackmasterFix on a Valheim server

Pick a server or deploy a new one above; it is installed in one click.

What kind of mod it is

From the catalog
Listed on Thunderstore as “Content”

Quality of life & UI

Small conveniences, tweaks and interface improvements players notice straight away.

Compatibility

Game
Valheim
Loaders
BepInEx
Requires
One-click install needs a BepInEx server.

Verified at the source

  • ✓ThunderstoreOfficial listing, checked 2026-10-16Open ↗
  • ✓Authors6652289, as published on Thunderstore
  • ✓LicenseNot published by the sourceFree

StackmasterFix, answered

Generated from the mod’s own source data.

Which loaders does it support?

BepInEx.

Is it free?

Yes. StackmasterFix is free to download from Thunderstore.

How do I add it to my Nxeon server?

Use “Add to a server” on this page, or open NxLabs from your dashboard. We install it, restart your server and switch it on.

NxLabs

Run StackmasterFix on a Valheim server.

Deploy in about a minute from $6.50 a month, then add StackmasterFix in one click.