一款 Fabric 模组,允许村民自动使用周围箱子或桶中的物品执行交易。
在村民上方设置一个输入箱,下方设置一个输出箱,通过简单的图形界面配置希望激活的交易,然后让村民在工作站旁自行处理其余事务。
功能
- 免手交易 — 只要输入箱中有购买物品且输出箱有空间,村民就会自动执行其报价
- 按村民单独配置 — 按住 Shift + 右键点击任意村民以打开配置界面
- 优先级排序 — 上下拖拽交易条目,使高价值报价优先执行
- 切换单个交易 — 仅启用你想要的交易,忽略其他
- 自然补货 — 使用 Minecraft 内置的交易限制(每个报价最多达到其
MaxUses,当村民访问其工作站时补货)
- 仅在村民工作时间内运行 — 交易仅在村民值班期间触发(游戏内白天,刻数 2000–9000),遵循原版 AI 逻辑
安装
要求:
- Minecraft 26.3、26.2 或 1.21.11 — 在“Versions”选项卡中选择对应你版本的文件。一旦 Fabric API 支持新的 Minecraft 版本,新发行版将自动构建和测试。
- Fabric Loader 和适用于该版本的 Fabric API
- Minecraft 26.x 需要 Java 25(官方启动器自带),1.21.11 需要 Java 21
将 villager-auto-trade-<version>.jar 放入你的 mods/ 文件夹中,与 Fabric API 一起。同时适用于客户端和专用服务器——对于多人游戏,每位玩家都需要安装此模组(配置界面为客户端侧)。
使用方法
按村民设置
[箱子或桶] ← 直接在村民上方(输入)
[村民] ← 站在输出箱上
[箱子或桶] ← 直接在村民下方(输出)
村民本身站在输出箱之上。在村民头顶上方一格放置一个输入箱。使用栅栏或其他类似结构防止村民离开。
配置交易
- 用村民想要购买的物品填满输入箱(例如:绿宝石、纸张、煤炭)
- Shift + 右键点击村民以打开配置界面
- 勾选希望自动执行的交易
- 使用 ↑ / ↓ 箭头设置优先级(列表顶部优先执行)
- 点击 Save(保存)
观察运行
在工作时间内,只要物品和输出空间可用,村民每秒会执行一次已启用的报价。一旦某个报价达到最大使用次数(红色 MAXED 徽章),模组将跳过它并继续下一个。村民通过在 workstation 工作来自动补货。
补货需要工作站处于可达范围内: 原版只会在村民站在其认领的工作站约 1.7 格以内时补货。将工作站直接放在村民围栏旁边,否则其报价会保持 MAXED 状态。
如果村民没有任何动作,请检查服务器日志:当缺少某些内容时(没有交易、上方或下方没有箱子),模组会为每个村民写一行日志;问题解决时也会写一行日志。
配置界面
该界面通过按住 Shift + 右键点击村民打开。显示:
- Auto Trade Enabled(自动交易启用)— 该村民的全局开/关开关
- 交易列表 — 复选框用于启用,↑↓ 按钮用于优先级,MAXED 指示器表示缺货的报价
- Save / Cancel(保存 / 取消)— 保存会将数据写入村民的 NBT 数据,重启后依然保留
兼容性
- 适用于所有村民职业(图书管理员、农民、武器匠等)以及任何类型的工作站
- 兼容箱子、陷阱箱、桶以及任何实现
Inventory 接口的方块实体
- 已知不与常见的 QoL 模组冲突
许可证
MIT — 欢迎自由使用、修改或再分发。
致谢
由 Dziko3000 制作。
A Fabric mod that lets villagers automatically execute their trades using items from chests or barrels placed directly around them.
Set up an input chest above the villager and an output chest beneath, configure which trades you want active via a simple GUI, and let the villager handle the rest while it works at its workstation.
Features
- Hands-free trading — villagers automatically execute their offers as long as they have buy items in the input chest and space in the output chest
- Per-villager configuration — shift + right-click any villager to open the config screen
- Priority ordering — drag trades up/down so high-value offers go first
- Toggle individual trades — enable only the trades you want, ignore the rest
- Natural restock — uses Minecraft's built-in trade limits (each offer caps at its
MaxUses, then restocks when the villager visits its workstation)
- Works during villager work hours — trades only fire while the villager is on duty (in-game day, ticks 2000–9000), respecting vanilla AI
Installation
Requirements:
- Minecraft 26.3, 26.2 or 1.21.11 — pick the file for your version on the Versions tab. New Minecraft releases are built and tested automatically as soon as Fabric API supports them.
- Fabric Loader and Fabric API for that version
- Java 25 for Minecraft 26.x (the official launcher brings it), Java 21 for 1.21.11
Drop villager-auto-trade-<version>.jar into your mods/ folder alongside Fabric API. Works on both client and dedicated server — for multiplayer, every player needs the mod installed (the configuration GUI is client-side).
How to use
Setup per villager
[Chest or Barrel] ← directly above the villager (input)
[Villager] ← standing on the output chest
[Chest or Barrel] ← directly below the villager (output)
The villager itself stands on top of the output chest. Place an input chest one block above the villager's head. Use a fence cell or similar to keep the villager from wandering off.
Configure trades
- Fill the input chest with the items the villager wants to buy (e.g. emeralds, paper, coal)
- Shift + right-click the villager to open the config screen
- Tick the trades you want auto-executed
- Use the ↑ / ↓ arrows to set priority (top of the list runs first)
- Click Save
Watch it run
During work hours, the villager will execute one trade per second per enabled offer, as long as items and output space are available. Once an offer reaches its max uses (red MAXED badge), the mod skips it and moves on. The villager restocks automatically by working at its workstation.
Restocking needs the workstation within reach: vanilla only restocks a villager that stands within about 1.7 blocks of its claimed workstation. Put the workstation right next to the villager's cell, or its offers stay MAXED.
If a villager does nothing, check the server log: the mod writes one line per villager when something is missing (no trades, no chest above or below), and one line when it is solved.
Config screen
The screen is opened with shift + right-click on a villager. It shows:
- Auto Trade Enabled — global on/off toggle for that villager
- List of trades — checkbox to enable, ↑↓ buttons for priority, MAXED indicator for offers that are out of stock
- Save / Cancel — save writes to the villager's NBT data, persisting across restarts
Compatibility
- Works with all villager professions (librarian, farmer, weaponsmith, etc.) and any workstation type
- Compatible with chests, trapped chests, barrels, and any block entity that implements
Inventory
- No conflicts known with common QoL mods
License
MIT — feel free to use, modify, or redistribute.
Credits
Made by Dziko3000.
评论 0
登录后参与评分
还没有评论,来抢沙发吧