Inventory Plus
Inventory Plus 将通常需要从多个模组中收集的物品栏功能整合到一个模组中。补货、排序、锁定槽位、切换工具和循环快捷栏等功能一应俱全,它们彼此协同工作,并可通过一个菜单进行配置。
它是客户端模组,因此适用于任何服务器。
功能
补货 (Restock)
- 当手中的物品堆耗尽时,从背包中补充该堆物品。
- 用背包中的相同物品或最接近的替代品替换损坏的工具或护甲部件。
- 也可以在工具或护甲即将损坏前自动更换。你可以设置耐久度降至多少时触发更换。
- 当背包中没有合适物品时,还可以从背包中的潜影盒和束口袋,以及你的末影箱中获取物品。此功能默认关闭。
排序 (Sort)
- 通过按钮或按键对任何容器或你自己的背包进行排序。
- 右键点击按钮可按类别、数量、ID 或稀有度排序。
- 按键则对鼠标悬停的容器进行排序。
移动匹配项 (Move Matching)
- 一次性将背包与打开的容器之间双方都拥有的所有物品移动到对方位置。
- 右键点击按钮可选择移动的数量。可以移动全部、每种堆叠除一件外的所有物品、每种物品除一整堆外的所有物品,或仅移动能完全容纳的物品。
- 可以设置某个选项绑定到特定容器,使该容器始终使用此设置。
自动工具切换 (Auto Tool Switch)
- 当你开始挖掘方块时,自动将合适的工具放入手中。
- 在攻击生物时,也可以根据你偏好的武器类型切换到武器。
- 停止操作后片刻,或按下指定按键时,切回之前手持的物品。
- 还可以从背包中的潜影盒或束口袋中取出工具或武器。
- 默认处于关闭状态,需手动开启。
锁定组 (Lock groups)
- 锁定某个槽位,使其免受排序、Shift 点击、拖拽和丢弃操作的影响。数字键切换和副手交换仍对该槽位有效。
- 锁定特定的完整物品(包括附魔和名称),无论它被放置在哪里或磨损程度如何。
- 适用于你的背包、末影箱,以及你打开的箱子、木桶、潜影盒、漏斗和发射器。
- 你可以创建自定义锁定组,每个组拥有独立颜色,可锁定槽位、某类物品的所有实例或单个特定物品。
可达范围 (Reach)
- 决定每个移动操作允许使用的槽位,适用于 Inventory Plus 的所有功能以及原版操作如 Shift 点击和丢弃。
- 每个锁定组在每个移动选项下都有一个复选框,让你精确选择哪些操作会被锁定阻止。
- 还可设置是否允许“补货”、“自动工具切换”和“拾取方块”从背包中的潜影盒/束口袋及末影箱中获取物品。
工具提示 (Tooltips)
- 在物品工具提示中添加耐久度、工具属性、食物值、食物效果及各附魔的简要说明。
- 将你当前穿戴或手持的护甲和工具进行比较显示。
- 按住空格键隐藏所有工具提示以查看其背后的内容;或者反向设置,使物品工具提示保持隐藏,直到你按住空格键。
- 打开屏幕时工具提示保持隐藏,直到你移动鼠标,避免光标下方弹出提示。
- 长工具提示支持鼠标滚轮滚动,宽工具提示会自动换行以适应屏幕宽度。
列循环器与快捷栏循环器 (Column Cycler and Hotbar Cycler)
- 列循环器将一个物品栏列中的物品循环轮换至快捷栏槽位。
- 快捷栏循环器将整个物品栏行循环轮换至快捷栏,使你只需一次按键即可访问第二套快捷栏物品。
- 两者默认均关闭。
统一设置菜单 (One settings menu)
- 每项功能都有独立的标签页,包含开关、按键和具体设置。
- Ctrl+点击(Mac 上是 Cmd+点击)任意 Inventory Plus 按钮即可打开对应功能的标签页。
依赖项
- Keybindery 1.1.0 或更高版本,用于设置菜单中的按键和按键按钮。
- MenuKit 7.5.0 或更高版本,低于 8.0.0,负责绘制按钮、设置菜单、快捷栏旁的条形区域以及工具提示变更。
- SlotKit 2.2.0 或更高版本,低于 3.0.0,用于告知 Inventory Plus 每个槽位的类型,以便锁定和“可达范围”知道哪些操作可能触及该槽位。
- Fabric API。
搭配推荐
- Hotbar Pockets,我的另一个模组,在快捷栏后方增加额外槽位。它为 Inventory Plus 设置菜单添加了一个“Pockets”标签页,并在背包右侧列中添加了一个开关。
兼容性
本模组运行于 Minecraft 26.3 的 Fabric 环境。安装在客户端后即可在任何服务器上生效,无需服务端安装任何东西。也可与服务端上的 Keybindery、MenuKit、SlotKit 和 Fabric API 一同安装,且不会对玩家产生任何影响。不能与 Inventory Max 共存(现已更名为 Hotbar Pockets)。
使用方法
背包上的按钮
打开背包或任何容器即可查看按钮。在创造模式下,这些按钮也出现在背包标签页中,但不会出现在物品标签页(因为那些页面没有完整的物品栏)。
如果游戏窗口高度不足以完整显示箱子界面,箱子的行会在框架内滚动,从而适应屏幕尺寸。
位于背包上方的一排小按钮用于执行操作。从左到右依次为:“移出匹配项”、“移入匹配项”和“排序”。只有在旁边打开了容器时,“移动匹配项”按钮才会出现。自带“排序”按钮的容器(如箱子、木桶、末影箱、潜影盒、漏斗、发射器或投掷器)会在其槽位上方显示该按钮。
位于背包右侧的列用于开启或关闭各项功能。从上到下依次是:设置按钮,然后是锁定组、补货、自动工具切换、列循环器和快捷栏循环器的开关。两个循环器开关在其各自的标签页中显示后才可见。“排序”和“移动匹配项”在此列中没有开关,需从其各自标签页中开启或关闭。
所有按钮的操作方式相同。
- 左键点击按钮以执行其操作,或左键点击开关以开启或关闭其功能。当功能开启时,开关的图标会反转。
- 右键点击具有模式的按钮可进入下一个模式。Shift+右键点击则返回上一个模式。
- Ctrl+点击(Mac 上是 Cmd+点击)Inventory Plus 的任何按钮,可在设置菜单中打开该功能的选项卡。按住 Ctrl 时,工具提示会显示此操作说明。
- 悬停在按钮上可查看其工具提示,其中显示当前模式以及每次点击的作用。
创造模式
Inventory Plus 在创造模式中的大多数功能与生存模式相同。
- 在创造模式的物品栏选项卡中,“排序”按钮和右侧列按常规显示,按 S 键可整理你的物品栏。在物品选项卡中,排序不会改变你的物品栏状态。
- 锁定功能在物品栏选项卡和物品选项卡上均有效,按 L 键可锁定或解锁这些位置的槽位。
- 列循环器的按键在物品栏选项卡上有效;当鼠标位于快捷栏槽位时,在物品选项卡上也有效。两个循环器的按键在未打开任何屏幕时均可使用。
- 快捷栏循环器的行按键和快捷键同样适用于物品栏选项卡。
- “移动匹配”在创造模式下打开的任何容器中都有效。
- 在创造模式中,“自动工具切换”不起作用,“补充库存”和“拾取方块”不会从潜影盒、包裹或末影箱中取物。
排序
- 左击物品栏上方的“排序”按钮以整理你的物品栏。快捷栏永远不会被排序。
- 左击容器上方的“排序”按钮以整理该容器。
- 右键点击“排序”按钮可更改排序顺序。顺序包括:类别(创意菜单的顺序,默认)、数量(同类物品最多的排在前面)、ID(按物品 ID 字母顺序)和稀有度(最稀有的排在前面)。
- 中键点击容器上方的“排序”按钮可将当前排序顺序固定到该容器。被固定的按钮会染成粉色,再次中键点击则取消固定。
- 在容器上方按下 S 键可对其排序。未打开容器时,S 键会根据鼠标所在位置整理你的物品栏。
- 当其他模组在同一屏幕上显示多个容器时(例如打开位于箱子下方的潜影盒),每个容器都有自己独立的“排序”按钮,并保留各自的排序顺序和固定状态,而 S 键会对鼠标悬停的那个容器进行排序。以这种方式打开的潜影盒、末影箱或包裹也会有一个“排序”按钮。
- 包裹会将其堆叠按照选定顺序排列。如果其中一个槽位被锁定,包裹将保持原状不变。
- 此类容器仅在其屏幕保持打开时才保留其排序顺序和固定状态;关闭屏幕后两者都会清除。其槽位锁定不受影响,下次打开时仍保持锁定状态。
- 被锁定的槽位和被锁定的物品在排序过程中保持原位不动,其余物品围绕它们重新排列。
“排序”选项卡包含以下设置:“排序”开关(默认开启)、显示“排序”按钮(默认开启)以及排序快捷键(S)。
移动匹配
- 左击“移出”按钮可将物品从你的物品栏移动到已打开的容器中,但仅限容器中已有的物品类型。
- 左击“移入”按钮可将物品从容器中移动到你的物品栏,但仅限你的物品栏中已有的物品类型。
- 右键点击任一按钮可更改移动的数量。“移动所有匹配物品”会将所有匹配物品全部移动。每种堆叠只留下一个物品的模式会在每种堆叠中留一个物品。“每种只留一组”的模式会在每种物品中留下一整组。“仅当全部容纳时移动”的模式仅在物品能完全放入时才进行移动。
- “移入”和“移出”按钮各自独立保存其模式。
- 中键点击“移出”按钮可将当前模式固定到已打开的容器。再次中键点击则取消固定。
- 当屏幕上打开多个容器时,“移出”只会将物品放入已有该物品的容器中。
- 按 O 键将匹配物品移出,按 I 键将它们移入。这两个按键在任何屏幕位置均可使用。
“移动匹配”选项卡包含以下设置:“移动匹配”开关(默认开启)、显示“移动匹配”按钮(默认开启)、以及快捷键“从物品栏移出”(O)和“移入物品栏”(I)。
补充库存
“补充库存”默认开启,并在游戏过程中持续生效,无需打开任何屏幕。
- 当手持物品或副手物品用完时,系统会从快捷栏或物品栏中用相同的物品进行补充。
- 当工具或盔甲损坏时,系统会用相同的物品替换它。如果你没有同种物品,则会替换为你拥有的最好的同类物品,例如用铁镐替换损坏的钻石镐。
- 若开启“损坏前交换”,当工具的耐久度降至你设定的数值时,会自动更换为更耐用的新工具或盔甲。
- 当你的物品栏中没有合适物品时,“补充库存”还可以从物品栏中的潜影盒或包裹中,或从你的末影箱中取物。这些设置在“探测范围”选项卡中分别针对物品、工具、盔甲和弹药(手中弓或弩使用的箭矢或火箭)进行配置,且每项默认均为关闭状态。
- “补充库存”绝不会从被“槽位锁定”锁定的槽位中取物。
- 在创造模式中,“补充库存”不会从潜影盒、包裹或末影箱中取物。
| 补充库存选项卡上的设置 |
默认值 |
| 补充库存(开关) |
开启 |
| 显示补充库存按钮 |
开启 |
| 损坏前交换的耐久度阈值 |
10(范围 2 至 50) |
| 补充物品 |
开启 |
| 补充工具 |
开启 |
| 损坏前交换(工具下) |
关闭 |
| 补充盔甲 |
开启 |
| 损坏前交换(盔甲下) |
关闭 |
自动工具切换
“自动工具切换”默认关闭。可通过物品栏右侧列中的开关或其所在选项卡开启。
- 当你开始挖掘一个方块时,手中会自动装备最适合该方块的工具。如果该工具在快捷栏中,选中的槽位会发生变化;如果在背包中,则会被交换到手中。
- 开启“切换武器”后,攻击敌对生物会将武器放入手中。当你拥有首选武器类型时,无论其材质如何都会使用它。开启“所有生物(不仅是敌对生物)”选项,即可对所有生物进行切换。
- 按住潜行键可挖掘或攻击而不发生切换。
- 当你的背包和手中没有合适工具或武器时,它可以尝试从背包中的末影箱或绑匪袋中取出一个。此功能在“Reach”标签页设置,默认关闭。不会搜索你的末影箱,因为工具选择仅基于本地客户端,且游戏不会显示已关闭的末影箱内部物品。
- 默认情况下,停止操作 1 秒后,快捷栏会自动恢复到你之前持有的物品。你可以更改等待时间、关闭此功能或使用按键替代。
- 创造模式下无效。
| “自动工具切换”标签页上的设置 |
默认值 |
| 自动工具切换(开关) |
关 |
| 显示自动工具切换按钮 |
开 |
| 自动切回 |
开 |
| 停止后等待秒数 |
1(范围 0 至 10) |
| 上一件工具的按键 |
关 |
| 按键(切回上一件工具) |
左 Shift |
| 同时切换武器 |
关 |
| 所有生物(不仅是敌对生物) |
关 |
| 首选武器 |
剑(或斧、锤、三叉戟或长矛) |
锁定组
锁定组是一个命名的、带有颜色的锁集合。初始有两个。
- 槽位锁:锁定某个槽位。其中的物品保持原位不动,即使你放入其他物品,移动操作也不会影响该槽位。默认情况下,它会阻止排序、匹配移动、Shift 点击、双击收集、拾取物品进入该槽位、丢弃、拖拽填充、补充库存从中取物以及选取块触碰携带容器。数字键和副手交换在锁定槽位上仍然有效。
- 精确物品锁:锁定特定物品本身,包括其附魔和名称,无论磨损程度如何。同类型的其他物品不会被锁定。默认情况下,它会阻止丢弃、Shift 点击移出、排序和使用匹配移动将其移出。收集器、循环器、补充库存、自动工具切换和匹配移动补全堆叠仍可使用它,且仅在持有该物品时计数:留在箱子中的一个物品会像其他物品一样被取出。
要锁定某物:
- 右键点击背包右侧列中的“锁定组”开关以选择一个组。Shift+ 右键点击可返回上一个组。开关会根据组的颜色着色,其提示框会显示组名。
- 将鼠标悬停在槽位或物品上并按 L 键以使用该组进行锁定。再次按 L 键可解锁。
- 选中槽位组后,按住 L 并移动鼠标跨越多个槽位可同时锁定多个槽位。
- 槽位锁适用于你的背包(包括护甲和副手)、末影箱以及你打开的任何箱子、桶、末影箱、漏斗或发射器。放置在容器中的锁定保存在你的计算机上,因此可在任何服务器上生效。
- 左键点击“锁定组”开关可暂停所有锁定而不删除任何锁定。
- 锁定在创造模式下也有效,适用于背包标签页和项目标签页。
- 当屏幕上打开多个容器时,每个容器的锁定都与其对应的容器绑定。
在“锁定组”标签页上,你的组以列表形式展示:
- “显示锁定按钮(开)”用于显示或隐藏“锁定组”开关。
- 点击一个组可打开其设置。显示其类型和密钥、颜色(点击可打开调色板,其中一个标签页包含 16 种染料颜色,另一个自定义标签页可选择任意颜色)以及重命名。槽位锁的密钥是“锁定槽位”键,其他组没有自己的密钥,因为 L 键会应用当前选中的组。
- 物品或精确物品组还会列出其锁定的物品。点击空槽位可从涵盖所有物品的可搜索网格中选择一个,或使用角落按钮移除一个。这些设置按世界保存,因此请在对应世界中选择。
- 列表上方的“+ 槽位组”、“+ 物品组”和“+ 精确物品组”按钮可创建新组。物品组锁定某一类型的所有物品,因此锁定一把钻石镐即锁定所有钻石镐。
- 列表顺序即为右键点击“锁定组”开关时循环的顺序。使用列表上方的箭头上下移动组。槽位锁和精确物品始终位于顶部。
- 你创建的组可以通过列表上方的按钮删除。其锁定会移至槽位锁或精确物品,但物品组的锁定会被移除。删除前会弹出确认对话框并说明影响的锁定数量。
- “重置为默认值”会移除你在所有世界中创建的组和所有锁定。
每个组阻止的操作可以在 Reach 中更改。
Reach
“Reach”标签页列出了所有可能改变槽位的操作,分为原版、Inventory Plus 和其他模组三类。每个操作都有一个部分,其中包含复选框,用于指定哪些槽位组、锁定组和循环器槽位可以被使用。取消勾选表示该操作永远不会触及该组。
- 例如,取消勾选“补充库存取物”部分的“精确物品”,将阻止补充库存使用被精确物品锁定的物品。
- 取消勾选“自动工具切换”部分的“槽位锁”,将阻止自动工具切换从锁定槽位中取出工具。
- “补充库存取物”、“自动工具切换”和“选取块”还包含针对背包中末影箱和绑匪袋的复选框,“补充库存”和“选取块”还包含针对末影箱的复选框。“补充库存”的复选框进一步细分为物品、工具、护甲和弹药。它们默认均关闭。
- 勾选这些复选框后,如果你的背包中没有相应物品,选取块会从这些容器中取出所选方块对应的物品。创造模式不受影响。
- “关闭”部分显示有多少个复选框处于开启状态,以及哪些锁定组阻止了该操作。自上次打开标签页以来新增的操作会标记为“new”。
- “还原单个操作”可将某一项操作恢复至默认状态。顶部的“重置为默认值”可将所有操作恢复至默认状态。
工具提示
“工具提示”开关默认开启。关闭它将使所有工具提示保持原版显示效果。
- 按住空格键可隐藏所有工具提示。空格键与跳跃功能共享,两者均正常工作。您可以在“工具提示”选项卡或控制设置中更改该按键。
- 启用「反之,隐藏物品工具提示并在按住按键时显示」后,物品工具提示默认保持隐藏,按住指定按键时会显示它们。按钮和菜单上的工具提示仍会正常显示。
- 打开屏幕时,工具提示将保持隐藏状态,直到您移动鼠标为止。
- 高度超过屏幕的工具提示可通过鼠标滚轮滚动,宽度超过屏幕的工具提示会自动换行。此功能始终处于开启状态。
- 启用「在顶部或底部停靠工具提示」后,原本会在鼠标旁边显示的工具提示将改为显示在屏幕底部中央;如果鼠标位于屏幕下部,则显示在屏幕顶部中央。
| 工具提示选项卡中的设置 |
默认值 |
| 在顶部或底部停靠工具提示 |
关闭 |
| 鼠标移动前隐藏工具提示 |
开启 |
| 按住按键以隐藏工具提示 |
开启 |
| 反之,隐藏物品工具提示并在按住按键时显示 |
关闭 |
| 隐藏或显示工具提示的按键 |
空格 |
| 耐久度 |
开启 |
| 食物:营养值和饱和度 |
开启 |
| 食物效果 |
开启 |
| 附魔描述 |
开启 |
| 按字母顺序排序附魔 |
开启 |
| 工具属性:挖掘速度、等级和附魔能力 |
开启 |
| 与当前穿戴或手持的物品进行比较 |
开启 |
| 合并盔甲纹饰行 |
开启 |
| 模组名称 |
关闭 |
设置菜单
通过库存界面右列顶部的“设置”按钮、Mod Menu 中 Inventory Plus 的配置按钮,或未设置按键时的“打开设置”按键来打开它。在 Minecraft 的控制菜单中为“打开设置”分配一个按键即可使用。按住 Ctrl(Mac 上为 Cmd)并点击 Inventory Plus 的任何按钮,可直接打开该功能对应的选项卡。
选项卡包括:常规、工具提示、范围、锁定组、排序、移动匹配项、自动补给、自动工具切换、列循环器和快捷栏循环器。其他模组的选项卡将显示在这些之后。每个功能选项卡顶部都有该功能的开关,接着是设置和按键;当功能关闭时,其设置和按键会呈灰色显示。每个选项卡都提供“重置为默认值”,重置前会进行确认。
即使某些功能的开关已开启,部分设置仍可能呈灰色。这些是计划中但尚未实现的功能。
在“常规”选项卡中:
- “打开设置”用于设置打开菜单的按键。
- “紧凑工具提示”(关闭)将库存按钮的工具提示缩短为一行。
- “外观”可在“默认”和“面板”之间切换菜单样式。“默认”样式类似 Minecraft 的设置屏幕(默认选项),“面板”样式类似容器。按钮名称会显示当前使用的外观,点击它可切换到另一种外观。
- “全部重置”会将菜单中的所有设置恢复为默认值,并移除所有锁定,操作前会进行确认。
每个按键也存在于 Minecraft 的控制菜单中,位于 Inventory Plus 分类下。
| 按键 |
默认值 |
| 锁定槽位 |
L |
| 排序 |
S |
| 从库存中移出匹配项 |
O |
| 移入匹配项到库存 |
I |
| 切换循环槽位 |
C |
| 列循环向前 |
上箭头 |
| 列循环向后 |
下箭头 |
| 快捷栏循环向前 |
] |
| 快捷栏循环向后 |
[ |
| 自动切换:返回上一个工具 |
左 Shift |
| 打开设置 |
未设置 |
| 隐藏或显示工具提示 |
空格 |
列循环器
列循环器默认处于关闭状态。请从其选项卡中开启。若要将该功能的开关放置在库存界面的右列,请开启“显示列循环器按钮”。
- 在库存(非快捷栏)中的任意槽位上按下 C,将其添加到该列的循环中。再次按下 C 可将其移除。按住 C 并跨槽位移动可将多个槽位添加进去。
- 在没有打开任何屏幕的情况下,按下上箭头和下箭头可旋转所选快捷栏槽位所在列的循环。
- 在库存界面中,悬停在循环内的某个槽位上,然后按下上箭头或下箭头可旋转该列。
- 在创造模式下,此功能适用于库存选项卡,以及当鼠标悬停在快捷栏槽位上时的物品选项卡。
- 该列中的物品会以条状形式显示在快捷栏旁边,您可以通过“快捷栏旁边”选项关闭此显示。
- 启用“滚动以循环”后,在带有循环的快捷栏槽位上滚动鼠标滚轮将执行循环操作,而非切换槽位。启用此功能会自动关闭快捷栏循环器的“滚动以循环”,因为只有一个滚轮。
| 列循环器选项卡中的设置 |
默认值 |
| 列循环器(开关) |
关闭 |
| 快捷栏旁边 |
迷你快捷栏(或关闭) |
| 显示列循环器按钮 |
关闭 |
| 切换循环槽位 |
C |
| 列循环向前 |
上箭头 |
| 列循环向后 |
下箭头 |
| 滚动以循环 |
关闭 |
快捷栏循环器
快捷栏循环器默认处于关闭状态。请从其选项卡中开启。若要将该功能的开关放置在库存界面的右列,请开启“显示快捷栏循环器按钮”。
- 悬停在库存的某一行上,该行左侧会出现一个小按钮。点击它可将该行添加到循环中,再次点击则移除该行。已在循环中的行的按钮会保持可见。
- 按下 ] 可将下一行带入您的快捷栏,按下 [ 可将当前行送回上方。物品会保留其列位置,快捷栏会滑动以展示变化。
- 这些按键在没有打开任何屏幕的情况下以及在库存界面中均有效,包括打开箱子时。在没有打开任何屏幕的情况下,创造模式也可使用。它们仅移动您自己的行。
- 启用“滚动以循环”后,鼠标滚轮将旋转行,而非切换快捷栏槽位。启用此功能会自动关闭列循环器的“滚动以循环”。
| 快捷栏循环器选项卡中的设置 |
默认值 |
| 快捷栏循环器(开关) |
关闭 |
| 显示快捷栏循环器按钮 |
关闭 |
| 显示行按钮 |
开启 |
| 快捷栏循环向前 |
] |
| 快捷栏循环向后 |
[ |
| 滚动以循环 |
关闭 |
面向模组开发者
其他模组可以向 Inventory Plus 添加自己的选项卡和开关,并与其循环器、自动补给和范围功能配合使用。公共 API 为 com.trevorschoeny.inventoryplus.api 包,且在该包内,除非主版本号变更,否则结构不会发生改变。
InventoryPlusApi.SETTINGS_MENU 用于命名设置菜单,以便通过 MenuKit 的 Tabs.addTo 添加选项卡。未指定锚点的选项卡会添加到 Inventory Plus 自带的选项卡之后。
registerSettingsReset 用于添加“重置所有内容”功能;confirmInSettings 则会在选项卡执行自身的“恢复默认值”操作前进行确认,行为方式与 Inventory Plus 的选项卡一致。
addFeatureSwitch 在物品栏右侧列添加一个开关,其交互逻辑与 Inventory Plus 自带的开关相同。
openSettings 和 settingsScreen 用于在指定选项卡上打开菜单,可通过 Ctrl+点击或 Mod Menu(模组菜单)入口触发。
HotbarCyclable 和 registerCyclable 允许拥有自身循环机制的模组与 Auto Tool Switch(自动工具切换)和 Restock(自动补给)共享该循环,从而使这些模组能够从中查找物品并将其移至快捷栏。
findRestockSource 和 suppressRestockFor 提供对 Restock 搜索功能的访问权限,并防止 Restock 将刻意为之的快捷栏更改误判为物品耗尽。
InventoryPlusOperations 包含了 Inventory Plus 作为 MenuKit 键执行的槽位操作,因此模组可以将其自定义移动操作发送为其中之一。denyInReach 可从某项操作可使用的槽位组中排除特定槽位组。
来自 Hotbar Pockets 的选项卡添加示例:
Tabs.addTo(InventoryPlusApi.SETTINGS_MENU,
Tabs.tab("hotbarpockets").label(Component.literal("Pockets")).body(PocketsSettingsTab::body));
InventoryPlusApi.registerSettingsReset(PocketsSettingsTab::reset);
Inventory Plus 是一个客户端模组,因此请将其依赖声明为可选或必需模组,不要使用 Jar-in-Jar 方式打包。API 文档详见 源代码 中的 Javadoc。
许可证
MIT
Inventory Plus
Inventory Plus brings the inventory features you'd normally collect from a handful of mods into one. Restocking, sorting, locking slots, switching tools, and cycling your hotbar are all here, built to work with each other and configured from one menu.
It's client-side, so it works on any server.
Features
Restock
- Refills the stack in your hand from your inventory when it runs out.
- Replaces a broken tool or armor piece with the same item from your inventory, or the closest match you have.
- Can also swap out a tool or armor piece just before it breaks. You set how low its durability gets before it swaps.
- Can also take from shulker boxes and bundles in your inventory, and from your ender chest, when your inventory has nothing that fits. It's off by default.
Sort
- Sorts any container, or your own inventory, with a button or a key.
- Right-click the button to sort by category, quantity, ID, or rarity.
- The key sorts whichever container your mouse is over.
Move Matching
- Moves every item that the other side already has between your inventory and an open container, in one click.
- Right-click a button to choose how much moves. It can move everything, all but one of each stack, all but one stack of each item, or only items that all fit.
- A setting can be pinned to one container, so that container always uses it.
Auto Tool Switch
- Puts the right tool in your hand when you start mining a block.
- Can also switch to a weapon when you attack a mob, using the weapon type you prefer.
- Switches back to what you were holding a moment after you stop, or when you press a key.
- Can also take a tool or weapon from a shulker box or bundle in your inventory.
- It's off until you turn it on.
Lock groups
- Locks a slot so sorting, shift-clicks, drags, and drops leave it alone. Number keys and the offhand swap still work on it.
- Locks one exact item, with its enchantments and name, wherever it goes and however worn it gets.
- Works in your inventory, your ender chest, and the chests, barrels, shulker boxes, hoppers, and dispensers you open.
- You can make your own groups, each with its own color, that lock slots, every item of a type, or one exact item.
Reach
- Decides which slots each move is allowed to use, for every Inventory Plus feature and for vanilla moves like shift-clicking and dropping.
- Each lock group has a checkbox under each move, so you choose exactly what a lock stops.
- Also sets whether Restock, Auto Tool Switch, and pick block may take from shulker boxes and bundles in your inventory, and from your ender chest.
Tooltips
- Adds durability, tool stats, food values, food effects, and a short description of each enchantment to item tooltips.
- Compares armor and tools with what you're wearing or holding.
- Hold Space to hide every tooltip and see what's behind it. Or turn it around, so item tooltips stay hidden until you hold Space.
- Tooltips stay hidden when a screen opens until you move the mouse, so none pops up under the cursor.
- Long tooltips scroll with the mouse wheel, and wide ones wrap to fit the screen.
Column Cycler and Hotbar Cycler
- Column Cycler rotates the items in one inventory column through a hotbar slot.
- Hotbar Cycler rotates whole inventory rows through your hotbar, so a second set of hotbar items is one key away.
- Both are off by default.
One settings menu
- Every feature has its own tab, with its switch, its keys, and its settings.
- Ctrl-click (Cmd on a Mac) any Inventory Plus button to open that feature's tab.
Requirements
- Keybindery 1.1.0 or newer, for the keys and the key buttons in the settings menu.
- MenuKit 7.5.0 or newer, below 8.0.0, which draws the buttons, the settings menu, the strip beside the hotbar, and the tooltip changes.
- SlotKit 2.2.0 or newer, below 3.0.0, which tells Inventory Plus what each slot is, so locks and Reach know what a move may touch.
- Fabric API.
Pairs well with
- Hotbar Pockets, my mod that adds extra slots behind your hotbar. It adds a Pockets tab to the Inventory Plus settings menu and a switch to the inventory's right column.
Compatibility
It runs on Minecraft 26.3 with Fabric. Install it on your client, and it works on any server with nothing installed there. It can also be installed on a server, with Keybindery, MenuKit, SlotKit, and Fabric API alongside it, and nothing changes for players. It can't be installed together with Inventory Max, which is now Hotbar Pockets.
How to use
The buttons on your inventory
Open your inventory or any container to see the buttons. In creative they're on the inventory tab too, but not on the item tabs, which have no inventory.
On a game window too short for a chest's screen, the chest's rows scroll inside its frame, so the screen fits.
The row of small buttons above your inventory is for actions. From left to right, it has Move Matching out, Move Matching in, and Sort. The Move Matching buttons only appear while a container is open next to your inventory. A container with a Sort button of its own (a chest, barrel, ender chest, shulker box, hopper, dispenser, or dropper) has it above its slots.
The column to the right of your inventory turns features on and off. From top to bottom, it has the Settings button, then a switch for Lock groups, Restock, Auto Tool Switch, Column Cycler, and Hotbar Cycler. The two cycler switches are hidden until you show them from their tabs. Sort and Move Matching have no switch in the column, and are turned on and off from their tabs.
Every button works the same way.
- Left-click a button to do its action, or left-click a switch to turn its feature on or off. A switch's icon inverts while its feature is on.
- Right-click a button that has modes to go to the next mode. Shift-right-click goes back one.
- Ctrl-click (Cmd on a Mac) any Inventory Plus button to open that feature's tab in the settings menu. Holding Ctrl changes the tooltip to say so.
- Hover a button to see its tooltip, which shows the current mode and what each click does.
In creative
Most of Inventory Plus works in creative the same as in survival.
- On creative's inventory tab, the Sort button and the column on the right show as usual, and S sorts your inventory. On an item tab, Sort leaves your inventory as it is.
- Locks hold on the inventory tab and on the item tabs, and L locks and unlocks slots there.
- Column Cycler's keys work on the inventory tab and, with your mouse on a hotbar slot, on the item tabs. Both cyclers' keys work with no screen open.
- Hotbar Cycler's row buttons and keys work on the inventory tab too.
- Move Matching works in any container you open in creative.
- Auto Tool Switch does nothing in creative, and Restock and pick block don't take from shulker boxes, bundles, or your ender chest there.
Sort
- Left-click the Sort button above your inventory to sort your inventory. Your hotbar is never sorted.
- Left-click the Sort button above a container to sort that container.
- Right-click a Sort button to change the order. The orders are Category (the creative menu's order, the default), Quantity (most of an item first), ID (alphabetical by item ID), and Rarity (rarest first).
- Middle-click the Sort button above a container to pin the current order to that container. A pinned button is tinted pink, and middle-clicking it again unpins it.
- Press S over a container to sort it. With no container open, S sorts your inventory wherever your mouse is.
- When another mod shows more than one container on a screen, such as a shulker box opened below a chest, each one gets its own Sort button and keeps its own order and pin, and S sorts whichever one your mouse is over. A shulker box, ender chest, or bundle opened this way has a Sort button too.
- A bundle sorts its stacks into the chosen order. If one of its slots is locked, the bundle is left as it is.
- A box like that keeps its order and pin only while its screen stays open; closing it clears both. Its slot locks aren't affected, and hold the next time you open it.
- Locked slots and locked items stay where they are while everything else is sorted around them.
The Sort tab has the Sort switch (on by default), Show the Sort button (on), and the Sort key (S).
Move Matching
- Left-click Move Matching out to move items from your inventory into the open container, but only items the container already has.
- Left-click Move Matching in to move items from the container into your inventory, but only items your inventory already has.
- Right-click either button to change how much moves. Move all matching items moves everything. All but one of each stack leaves one item in each stack. All but one stack of each leaves one full stack of each item. Only if they all fit moves an item only when all of it fits.
- The in and out buttons keep separate modes.
- Middle-click Move Matching out to pin its mode to the open container. Middle-click it again to unpin.
- When more than one container is open on a screen, Move Matching out puts each item only into a container that already has it.
- Press O to move matching items out and I to move them in. The keys work anywhere in the screen.
The Move Matching tab has the Move Matching switch (on by default), Show the Move Matching buttons (on), and the keys Move Matching Out of Inventory (O) and Move Matching Into Inventory (I).
Restock
Restock is on by default and works while you play, with no screen open.
- When the stack in your hand or offhand runs out, it's refilled with the same item from your hotbar or inventory.
- When a tool or armor piece breaks, it's replaced with the same item. If you don't have one, it's replaced with the best item of the same kind you have, such as an iron pickaxe for a broken diamond one.
- With Swap before it breaks turned on, a tool or armor piece is swapped for a fresher one once its durability drops to the number you set.
- Restock can also take from a shulker box or bundle in your inventory, or from your ender chest, when your inventory has nothing that fits. This is set on the Reach tab, separately for items, tools, armor, and ammo (arrows or rockets for the bow or crossbow in your hand), and each starts off.
- Restock never takes from a slot locked with Slot lock.
- In creative, Restock doesn't take from shulker boxes, bundles, or your ender chest.
| Setting on the Restock tab |
Default |
| Restock (the switch) |
On |
| Show the Restock button |
On |
| Swap before breaking at durability |
10 (from 2 to 50) |
| Restock items |
On |
| Restock tools |
On |
| Swap before it breaks (under Tools) |
Off |
| Restock armor |
On |
| Swap before it breaks (under Armor) |
Off |
Auto Tool Switch
Auto Tool Switch is off by default. Turn it on with its switch in the inventory's right column, or on its tab.
- When you start mining a block, the best tool you have for it is put in your hand. If the tool is in your hotbar, the selected slot changes. If it's in your inventory, it's swapped into your hand.
- With Switch weapons too turned on, attacking a hostile mob puts a weapon in your hand. Your preferred weapon type is used when you have it, whatever its material. Turn on All mobs, not just hostile ones to switch for every mob.
- Hold Sneak to mine or attack without switching.
- When your inventory and hand have no tool or weapon that fits, it can take one from a shulker box or bundle in your inventory. This is set on the Reach tab and starts off. Your ender chest isn't searched, since the tool is picked on your side and the game doesn't show you what's in a closed ender chest.
- By default, your hotbar switches back to what you were holding 1 second after you stop. You can change the wait, turn it off, or use a key instead.
- It does nothing in creative.
| Setting on the Auto Tool Switch tab |
Default |
| Auto Tool Switch (the switch) |
Off |
| Show the Auto Tool Switch button |
On |
| Switch back automatically |
On |
| Seconds after you stop |
1 (from 0 to 10) |
| Key to previous tool |
Off |
| Key (switches back to the previous tool) |
Left Shift |
| Switch weapons too |
Off |
| All mobs, not just hostile ones |
Off |
| Preferred weapon |
Sword (or Axe, Mace, Trident, or Spear) |
Lock groups
A lock group is a named, colored set of locks. There are two to start with.
- Slot lock locks a slot. Whatever is in it stays put, and moves leave the slot alone even after you put something else in it. By default it stops sorting, Move Matching, shift-clicks, double-click collecting, item pickup into the slot, dropping, drag-filling, Restock taking from it, and pick block reaching into a carried container. Number keys and the offhand swap still work on a locked slot.
- Exact item locks one item as it is, with its enchantments and name, however worn it gets. Another item of the same type isn't locked. By default it stops dropping, shift-clicking it out, sorting, and moving it out with Move Matching. Collecting, the cyclers, Restock, Auto Tool Switch, and Move Matching topping up a stack can still use it, and it counts only while you're carrying the item: one left in a chest comes back out like anything else.
To lock something:
- Right-click the Lock groups switch in the inventory's right column to pick a group. Shift-right-click goes back. The switch is tinted with the group's color, and its tooltip names the group.
- Press L over a slot or an item to lock it with that group. Press L on it again to unlock it.
- With a slot group picked, hold L and move the mouse across slots to lock several at once.
- Slot locks work in your inventory (armor and offhand included), your ender chest, and any chest, barrel, shulker box, hopper, or dispenser you open. Locks in placed containers are kept on your computer, so they work on any server.
- Left-click the Lock groups switch to pause every lock without deleting any.
- Locks hold in creative too, on the inventory tab and on the item tabs.
- When more than one container is open on a screen, each one's locks stay with that container.
On the Lock groups tab, your groups are a list:
- Show the lock button (on) shows or hides the Lock groups switch.
- Click a group to open its settings. They show its kind and key, Color, which opens a picker with the 16 dye colors on one tab and any color on its Custom tab, and Rename. Slot lock's key is the Lock Slot key, and the other groups have no key of their own, since L applies whichever group is picked.
- An Item or Exact item group also lists the items it locks. Click the empty slot to pick one from a searchable grid of every item, or remove one with its corner button. These are kept per world, so pick them while you're in one.
- The + Slot group, + Item group, and + Exact item group buttons above the list make a new group. An Item group locks every item of one type, so locking one diamond pickaxe locks every diamond pickaxe.
- The order of the list is the order the Lock groups switch goes through when you right-click it. Move a group up or down with the arrows above the list. Slot lock and Exact item stay at the top.
- A group you made can be deleted with the button above the list. Its locks move to Slot lock or Exact item, except an Item group's, which are removed. It asks first and says how many locks it affects.
- Reset to Defaults removes every group you made and every lock, in every world.
What each group stops can be changed in Reach.
Reach
The Reach tab lists every move that can change your slots, under Vanilla, Inventory Plus, and Other mods. Each move has a section with checkboxes for the slot groups, lock groups, and cycler slots it can use. A cleared box means that move never touches that group.
- For example, clearing Exact item in the Restock takes from section stops Restock from using items locked with Exact item.
- Clearing Slot lock in the Auto Tool Switch section stops Auto Tool Switch from taking tools out of locked slots.
- Restock takes from, Auto Tool Switch, and Pick block also have boxes for the shulker boxes and bundles in your inventory, and Restock and Pick block have one for your ender chest. Restock's are split into items, tools, armor, and ammo. They all start off.
- With those boxes ticked, pick block takes the picked block's item from those containers when your inventory has none. Creative isn't affected.
- The closed section shows how many boxes are on and which lock groups stop the move. A move that's new since you last opened the tab is marked new.
- Revert to default puts one move back. Reset to Defaults at the top puts every move back.
Tooltips
The Tooltips switch is on by default. Turning it off leaves every tooltip as vanilla shows it.
- Hold Space to hide every tooltip. Space is shared with Jump, and both still work. You can change the key on the Tooltips tab or in Controls.
- With Instead, hide item tooltips and show them while the key is held turned on, item tooltips stay hidden and holding the key shows them. Tooltips on buttons and menus still show.
- When a screen opens, tooltips stay hidden until you move the mouse.
- A tooltip taller than the screen scrolls with the mouse wheel, and one wider than the screen wraps. These are always on.
- With Dock tooltips at top or bottom turned on, a tooltip that would open beside your mouse sits at the bottom center of the screen instead, or at the top center when your mouse is down there.
| Setting on the Tooltips tab |
Default |
| Dock tooltips at top or bottom |
Off |
| Hide tooltips until the mouse moves |
On |
| Hold a key to hide tooltips |
On |
| Instead, hide item tooltips and show them while the key is held |
Off |
| Hide or Show Tooltips key |
Space |
| Durability |
On |
| Food: nutrition and saturation |
On |
| Food effects |
On |
| Enchantment descriptions |
On |
| Sort enchantments alphabetically |
On |
| Tool stats: mining speed, tier and enchantability |
On |
| Compare with what you're wearing or holding |
On |
| Condense armor trim lines |
On |
| Mod name |
Off |
The settings menu
Open it with the Settings button at the top of the inventory's right column, with Inventory Plus's config button in Mod Menu, or with the Open Settings key, which has no key until you set one. Ctrl-click (Cmd on a Mac) any Inventory Plus button to open it on that feature's tab.
The tabs are General, Tooltips, Reach, Lock groups, Sort, Move Matching, Restock, Auto Tool Switch, Column Cycler, and Hotbar Cycler. Tabs from other mods come after these. Each feature tab has the feature's switch at the top, then its settings and keys, which are grayed while the feature is off. Every tab has Reset to Defaults, which asks before it resets that tab's settings and keys.
Some settings are grayed even with their feature on. Those are planned and don't do anything yet.
On the General tab:
- Open Settings sets the key that opens the menu.
- Compact tooltips (off) shortens the inventory buttons' tooltips to one line.
- Look switches the menu between Default, which looks like Minecraft's Options screens (the default), and Panel, which looks like a container. The button names the look in use, and clicking it switches to the other.
- Reset everything puts every setting in the menu back to its default and removes every lock, after asking.
Every key is also in Minecraft's Controls menu, under Inventory Plus.
| Key |
Default |
| Lock Slot |
L |
| Sort |
S |
| Move Matching Out of Inventory |
O |
| Move Matching Into Inventory |
I |
| Toggle Cycle Slot |
C |
| Column Cycle Forward |
Up arrow |
| Column Cycle Backward |
Down arrow |
| Hotbar Cycle Forward |
] |
| Hotbar Cycle Backward |
[ |
| Auto-Switch: Return to Previous Tool |
Left Shift |
| Open Settings |
Not set |
| Hide or Show Tooltips |
Space |
Column Cycler
Column Cycler is off by default. Turn it on from its tab. To put its switch in the inventory's right column, turn on Show the Column Cycler button.
- Press C over a slot in your inventory (not your hotbar) to add it to its column's cycle. Press C again to take it out. Hold C and move across slots to add several.
- With no screen open, press the Up and Down arrows to rotate the cycle in the column of your selected hotbar slot.
- In your inventory, hover a slot in the cycle and press Up or Down to rotate that column.
- In creative, this works on the inventory tab, and on the item tabs with your mouse on a hotbar slot.
- The column's items show in a strip beside the hotbar, which you can turn off with Beside the hotbar.
- With Scroll to cycle on, scrolling the mouse wheel on a hotbar slot with a cycle rotates the cycle instead of changing slots. Turning it on turns off Hotbar Cycler's Scroll to cycle, since there is one wheel.
| Setting on the Column Cycler tab |
Default |
| Column Cycler (the switch) |
Off |
| Beside the hotbar |
Mini hotbar (or Off) |
| Show the Column Cycler button |
Off |
| Toggle Cycle Slot |
C |
| Column Cycle Forward |
Up arrow |
| Column Cycle Backward |
Down arrow |
| Scroll to cycle |
Off |
Hotbar Cycler
Hotbar Cycler is off by default. Turn it on from its tab. To put its switch in the inventory's right column, turn on Show the Hotbar Cycler button.
- Hover a row of your inventory and a small button appears at its left. Click it to add the row to the cycle, or click it again to take the row out. Buttons of rows in the cycle stay visible.
- Press ] to bring the next row down into your hotbar and [ to send it back up. Items keep their columns, and the hotbar slides to show the change.
- The keys work with no screen open and in your inventory, including with a chest open. With no screen open they work in creative too. They only move your own rows.
- With Scroll to cycle on, the mouse wheel rotates the rows instead of changing hotbar slots. Turning it on turns off Column Cycler's Scroll to cycle.
| Setting on the Hotbar Cycler tab |
Default |
| Hotbar Cycler (the switch) |
Off |
| Show the Hotbar Cycler button |
Off |
| Show the row buttons |
On |
| Hotbar Cycle Forward |
] |
| Hotbar Cycle Backward |
[ |
| Scroll to cycle |
Off |
For mod developers
Other mods can add their own tab and switch to Inventory Plus, and work with its cyclers, Restock, and Reach. The public API is the com.trevorschoeny.inventoryplus.api package, and nothing in it changes shape without a major version.
InventoryPlusApi.SETTINGS_MENU names the settings menu, for adding a tab with MenuKit's Tabs.addTo. Tabs added without an anchor go after Inventory Plus's own.
registerSettingsReset adds a reset to Reset everything, and confirmInSettings asks before a tab's own Reset to Defaults, the same way Inventory Plus's tabs do.
addFeatureSwitch adds an on and off switch to the inventory's right column, which behaves like Inventory Plus's own.
openSettings and settingsScreen open the menu on a given tab, for a Ctrl-click or a Mod Menu entry.
HotbarCyclable and registerCyclable let a mod with its own cycle share it with Auto Tool Switch and Restock, which can then find items in it and bring them down.
findRestockSource and suppressRestockFor give access to Restock's search and keep Restock from treating a deliberate hotbar change as an item running out.
InventoryPlusOperations holds the slot operations Inventory Plus performs as MenuKit keys, so a mod can send its own moves as one of them. denyInReach takes slot groups out of what an operation may use.
Adding a tab, from Hotbar Pockets:
Tabs.addTo(InventoryPlusApi.SETTINGS_MENU,
Tabs.tab("hotbarpockets").label(Component.literal("Pockets")).body(PocketsSettingsTab::body));
InventoryPlusApi.registerSettingsReset(PocketsSettingsTab::reset);
Inventory Plus is a client mod, so depend on it as an optional or required mod and don't bundle it with Jar-in-Jar. The API is documented in the Javadoc of the source code.
License
MIT.
评论 0
登录后参与评分
还没有评论,来抢沙发吧