Restricted Inventory
将玩家物品栏槽位锁定为特定物品或物品标签。
是否曾想过为剑保留一个专属槽位、让 0 号槽始终放置火把,或在服务器上强制实行物品整理?Restricted Inventory 正是为此而生——你可以配置任意物品栏槽位(0–35),使其仅接受特定的物品或物品标签,支持全服统一设置或按玩家分别设置。
功能特性
- 槽位限制 — 将任意快捷栏或物品栏槽位锁定为特定物品(例如
minecraft:torch)或整个物品标签(例如#minecraft:swords) - 服务器端或客户端模式 — 通过服务器配置文件将所有玩家应用相同的规则,或允许每个玩家在客户端配置文件中自定义自己的限制
- 视觉反馈 — 受限槽位会显示所需物品的幽灵预览图,让玩家清楚知道该放入什么
- 槽位索引叠加层 — 在任何物品栏界面按住 Tab 键即可显示每个槽位的索引编号,使配置设置变得轻而易举
- 智能物品路由 — 拾取的物品会优先自动进入其指定槽位,然后再填充未受限制的槽位
命令
所有命令均使用 /restrictedinventory 前缀。
| 命令 | 描述 | 权限 |
|---|---|---|
/restrictedinventory config |
打开限制配置屏幕 | 管理员(OP 等级 4),或在启用 useClientRestriction 时任何玩家均可使用 |
权限规则
- 当
useClientRestriction为 false(全服模式):仅服务器操作员(OP 等级 4)可以打开配置屏幕。 - 当
useClientRestriction为 true(按客户端模式):每位玩家都可以打开自己的配置屏幕。
限制配置屏幕
配置屏幕是用于编辑槽位限制的内置游戏 GUI。通过 /restrictedinventory config 打开它。
物品/标签选择器(顶部面板)
- 物品标签页 — 以 ¾ 比例列出所有已注册物品。悬停可查看物品名称和注册 ID。点击进行选择。
- 标签标签页 — 列出所有已注册物品标签。每个标签会循环显示其成员作为实时预览。悬停可查看标签 ID。点击进行选择。
- 使用鼠标滚轮滚动或拖动右侧的滚动条。
槽位网格(中间面板)
- 以标准物品栏布局显示全部 36 个玩家物品栏槽位(0–35)。
- 每个槽位会循环显示其当前限制内容的预览,若未受限制则显示为空。
- 左键点击槽位以选中它(高亮显示为白色)。选中的槽位将接收选择器中选定的物品或标签。
- 右键点击槽位以移除已选定的物品或标签。
- 悬停在槽位上可看到其当前限制值的工具提示。
配置
限制条件定义在一个简单的 JSON 配置文件中。支持具体物品和物品标签。也支持 NBT/组件(Components)。
{
"useClientRestriction": false,
"useTeamAndTagRestrictions": true,
"restrictedSlots": {
"0": "minecraft:torch",
"1": {
"item": "#minecraft:swords",
"display": { // 这是一个带有 nbt/组件的物品示例
"components": { // 1.20.1 版本请使用 "tag"
"minecraft:stored_enchantments": {
"mineraft:silk_touch": 1
},
}
},
"2": {
"item": "minecraft:enchanted_book",
"components": { // 1.20.1 版本请使用 "tag"
"minecraft:stored_enchantments": {
"mineraft:silk_touch": 1
},
"display": "minecraft:dirt" // 这是一个纯物品示例
}
},
"3": {
"group": "group_name"
}
},
"groups": { // 仅在通用配置中可用
"group_name": [
{"item": "minecraft:dirt"},
{
"item": "minecraft:enchanted_book",
"components": { // 1.20.1 版本请使用 "tag"
"minecraft:stored_enchantments": {
"mineraft:silk_touch": 1
}
}
]
},
"teamRestrictions": {
"team": {
"restrictedSlots": {
"0": "minecraft:dirt"
}
}
},
"tagRestrictions": {
"dirt": {
"restrictedSlots": {
"1": "minecraft:grass_block"
}
}
}
}
| 槽位范围 | 位置 |
|---|---|
| 0–8 | 快捷栏(仅限生存模式) |
| 9–35 | 主物品栏 |
注意: 槽位索引 0–8 对应生存模式下的快捷栏。在创造模式下,快捷栏使用不同的物品栏布局,且槽位限制不会在那里生效。
兼容性说明
本模组通过 Mixin 挂钩到原版游戏的槽位放置和物品拾取逻辑。直接插入物品到玩家物品栏(绕过标准槽位逻辑)的模组或方块实体可能不会遵守这些限制。同样修改 Slot、Inventory 或 AbstractContainerScreen 的模组可能会产生冲突。
Restricted Inventory
Lock player inventory slots to specific items or item tags.
Ever wanted to keep a dedicated slot for your sword, always have slot 0 as your torch, or enforce item organization across your server? Restricted Inventory lets you do exactly that — configure any inventory slot (0–35) to only accept a specific item or item tag, server-wide or per player.
Features
- Slot restrictions — Lock any hotbar or inventory slot to a specific item (e.g.
minecraft:torch) or an entire item tag (e.g.#minecraft:swords) - Server or per-client mode — Apply the same rules to all players from the server config, or let each player define their own restrictions in their client config
- Visual feedback — Restricted slots display a ghost preview of the required item so players always know what goes where
- Slot index overlay — Hold Tab in any inventory screen to reveal each slot's index number, making config setup a breeze
- Smart item routing — Picked-up items automatically go to their designated slots first before filling unrestricted ones
Commands
All commands use the /restrictedinventory prefix.
| Command | Description | Permission |
|---|---|---|
/restrictedinventory config |
Opens the Restriction Config Screen | Admin (OP level 4), or any player when useClientRestriction is enabled |
Permission rules
- When
useClientRestrictionis false (server-wide mode): only server operators (OP level 4) can open the config screen. - When
useClientRestrictionis true (per-client mode): every player can open their own config screen.
Restriction Config Screen
The config screen is the in-game GUI for editing slot restrictions. Open it with /restrictedinventory config.
Item / Tag picker (top panel)
- Items tab — lists every registered item at ¾ scale. Hover for the item name and registry ID. Click to select.
- Tags tab — lists every registered item tag. Each tag cycles through its members as a live preview. Hover for the tag ID. Click to select.
- Scroll with the mouse wheel or drag the scrollbar on the right.
Slot grid (middle panel)
- Displays all 36 player inventory slots (0–35) laid out in the standard inventory arrangement.
- Each slot shows a cycling preview of its current restriction, or is empty if unrestricted.
- Left-Click a slot to select it (highlighted in white). The selected slot will receive the item or tag chosen in the picker.
- Right-Click a slot to remove the item or tag chosen.
- Hover a slot to see its current restriction value as a tooltip.
Configuration
Restrictions are defined in a simple JSON config file. Both specific items and item tags are supported. Nbt/Components is also supported.
{
"useClientRestriction": false,
"useTeamAndTagRestrictions": true,
"restrictedSlots": {
"0": "minecraft:torch",
"1": {
"item": "#minecraft:swords",
"display": { // this is an example with item with nbt/component
"components": { // use "tag" for 1.20.1
"minecraft:stored_enchantments": {
"mineraft:silk_touch": 1
},
}
},
"2": {
"item": "minecraft:enchanted_book",
"components": { // use "tag" for 1.20.1
"minecraft:stored_enchantments": {
"mineraft:silk_touch": 1
},
"display": "minecraft:dirt" // this is an example with plain item
}
},
"3": {
"group": "group_name"
}
},
"groups": { // Only available in common config
"group_name": [
{"item": "minecraft:dirt"},
{
"item": "minecraft:enchanted_book",
"components": { // use "tag" for 1.20.1
"minecraft:stored_enchantments": {
"mineraft:silk_touch": 1
}
}
]
},
"teamRestrictions": {
"team": {
"restrictedSlots": {
"0": "minecraft:dirt"
}
}
},
"tagRestrictions": {
"dirt": {
"restrictedSlots": {
"1": "minecraft:grass_block"
}
}
}
}
| Slot range | Location |
|---|---|
| 0–8 | Hotbar (survival mode only) |
| 9–35 | Main inventory |
Note: Slot indices 0–8 correspond to the hotbar in survival mode. In creative mode, the hotbar uses a different inventory layout and slot restrictions will not apply there.
Compatibility Note
This mod hooks into vanilla's slot placement and item pickup logic via Mixin. Mods or block entities that insert items directly into the player inventory (bypassing standard slot logic) may not respect the restrictions. Mods that also modify Slot, Inventory, or AbstractContainerScreen may conflict.
下载 Restricted Inventory
下载 Restricted Inventory
下载 Restricted Inventory
下载 Restricted Inventory
下载 Restricted Inventory
下载 Restricted Inventory
下载 Restricted Inventory
下载 Restricted Inventory
下载 Restricted Inventory
下载 Restricted Inventory
21.1.12
- 修复了在 NeoForge 上重生后受限物品栏图标消失的问题。
20.1.11
- 修复了在 Minecraft 1.20.1 中,Inmis 背包的库存允许将物品放入锁定或受限的玩家库存槽位的问题。
26.3.0.1
NeoForge
- 升级至
26.3.0.22-beta,并解决了由 NeoForge 引起的破坏性变更
Fabric
无更改。
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
查看物品与配方
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
AE2:一款流行的自动化与存储模组
模组
那是什么?一个 Waila/Hwyla 的分支。
评论 0
登录后参与评分
还没有评论,来抢沙发吧