Item Commander
闪亮的物品执行各种操作
一个简单的服务端 Fabric 模组,允许你为物品(堆)分配命令。
它通过将 NBT 数据添加到物品上来工作,当玩家使用物品时,会检查该物品的 NBT 数据,如果包含 ItemCommander 标签树,则执行指定的命令。
要将命令嵌入到物品中,将物品拿在主手并运行 /commander create "<command>" [CONSUME_ACTION] [COMMAND_SOURCE] [cooldownTicks] [CustomItemNBT]
消耗动作:
| 动作 | 描述 |
|---|---|
| CONSUME | 消耗该物品 |
| KEEP | 保留该物品 |
命令来源:
| 动作 | 描述 |
|---|---|
| SERVER | 由服务器执行的命令 |
| PLAYER | 由玩家执行的命令 |
| OP | 由拥有 OP 权限的玩家执行的命令 |
| SERVER_AS_PLAYER | 由服务器以玩家身份执行的命令(类似于 OP) |
| DANGEROUSLY_OP | 玩家在拥有 OP 权限时执行的命令 ⚠️ |
默认值以 粗体 显示
命令占位符
创建命令时,你可以使用以下类似原版的占位符:
| 占位符 | 作用 |
|---|---|
@itemname |
物品名称 |
@pich |
玩家俯仰角 (pitch) |
@yaw |
玩家偏航角 (yaw) |
@ix |
物品使用时的 X 坐标 |
@iy |
物品使用时的 Y 坐标 |
@iz |
物品使用时的 Z 坐标 |
@x |
玩家使用物品时的 X 坐标 |
@y |
玩家使用物品时的 Y 坐标 |
@z |
玩家使用物品时的 Z 坐标 |
@p and @s |
使用该指挥官物品的玩家 |
要向一个物品追加更多命令,将指挥官物品拿在主手并运行 /commander append "<command>"
要保存指挥官物品,将其拿在主手并运行 /commander save <fileName>
要加载/给予指挥官物品,运行 /commander give <fileName> [quantity] [player(s)]
本 模组 支持 Patbox 的文本占位符 API。
- 你可以在指挥官物品中使用
%modid:type%或%modid:type/data%来利用自定义占位符 - 示例:
commander create
本 模组 支持 LuckPerms 的 Fabric 权限 API。
commander.command.create允许玩家使用此 模组 将命令嵌入物品commander.command.append允许玩家使用此 模组 向指挥官物品追加命令commander.command.give允许玩家使用此 模组 给自己发放指挥官物品commander.command.save允许玩家使用此 模组 将指挥官物品保存到服务器的文件中
示例
创建指挥官物品
/commander create "say Hello myself (@s), you clicked at @ix, @iy, @iz!" KEEP OP 20 paper{display:{Name:'[{"text":"Commander Test Item!","italic":false}]'}}
向指挥官物品追加额外命令
/commander append "If you have Text Placeholder API, this will be your name: %player:name%"
保存指挥官物品
/commander save commander_test_item
将保存的物品加载/给予玩家
/commander give commander_test_item 1 @p
开发版构建
上游构建可通过 GitHub Actions 获取。
设置
有关设置说明,请参阅与你正在使用的 IDE 相关的 fabric wiki 页面。
许可证
本模板在 CC0 许可下可用。欢迎学习它并将其融入你自己的项目中。
Item Commander
Shiny item do stuff
A simple Serverside Fabric mod that allows you to assign commands to Item(Stacks).
It works by adding NBT data to the item, then when a player uses an item the NBT data for that item is checked, if it contains the ItemCommander tag tree it executes the specified command.
To embed a command in an item, hold it in your main hand and run /commander create "<command>" [CONSUME_ACTION] [COMMAND_SOURCE] [cooldownTicks] [CustomItemNBT]
consume actions:
| Action | Description |
|---|---|
| CONSUME | Consumes the item |
| KEEP | Keeps the item |
command sources:
| Action | Description |
|---|---|
| SERVER | Command executed by the server |
| PLAYER | Command executed by the player |
| OP | Command executed by the player with OP |
| SERVER_AS_PLAYER | Command executed by the server as the player (like OP) |
| DANGEROUSLY_OP | Command executed by the player whilst being OP ⚠️ |
defaults in bold*
Command placeholders
when creating a command you can use the following vanilla-like placeholders:
| Placeholder | Action |
|---|---|
@itemname |
Item Name |
@pich |
Player pitch |
@yaw |
Player yaw |
@ix |
Item use X coordinate |
@iy |
Item use Y coordinate |
@iz |
Item use Z coordinate |
@x |
Player use X coordinate |
@y |
Player use Y coordinate |
@z |
Player use Z coordinate |
@p and @s |
The player using the Commander Item |
To append more commands to one item, hold a Commander Item in your main hand and run /commander append "<command>"
To save a Commander Item, hold it in your main hand and run /commander save <fileName>
To load/give a Commander Item, run /commander give <fileName> [quantity] [player(s)]
This mod supports Patbox' Text Placeholders API.
- You can use
%modid:type%or%modid:type/data%inside a Commander Item to make use of a custom placeholder - Example:
commander create
This mod supports LuckPerms' Fabric Permission API.
commander.command.createallows a player to use this mod to embed commands in itemscommander.command.appendallows a player to use this mod to append commands to Commander Itemscommander.command.giveallows a player to use this mod to give itself Commander Itemscommander.command.saveallows a player to use this mod to save Commander Items to a file on the server
Examples
Creating a Commander Item
/commander create "say Hello myself (@s), you clicked at @ix, @iy, @iz!" KEEP OP 20 paper{display:{Name:'[{"text":"Commander Test Item!","italic":false}]'}}
Appending an extra command to a Commander Item
/commander append "If you have Text Placeholder API, this will be your name: %player:name%"
Saving a Commander Item
/commander save commander_test_item
Giving/loading a saved item to a player
/commander give commander_test_item 1 @p
Bleeding edge builds
Upstream builds are available via GitHub Actions.
Setup
For setup instructions please see the fabric wiki page that relates to the IDE that you are using.
License
This template is available under the CC0 license. Feel free to learn from it and incorporate it in your own projects.
下载 Item Commander
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Item Commander
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Item Commander
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Item Commander
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Item Commander
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Item Commander
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Item Commander
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Item Commander
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Item Commander
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Item Commander
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
⚠️ 此为预发布版本!几乎未进行测试!请谨慎操作!
这好得令人难以置信……
此版本修复了指挥官数据无法应用至新物品的问题(也就是模组功能的一半)。
如果发现任何异常,请告知我!
GitHub 发布页:
完整更新日志:
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
一个用于收集生物掉落物的多区块模组。
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
查看物品与配方
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
适用于 MC 1.18+ 的 Effekseer 加载器
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
评论 0
登录后参与评分
还没有评论,来抢沙发吧