Item Commander
A simple Serverside Fabric mod that allows you to assign commands to Item(Stacks)
截图
介绍
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 支持哪些 Minecraft 版本?
Item Commander 支持 Minecraft Java 版 1.18–1.21.1,共 12 个版本,可用的加载器:Fabric / Quilt。下载时注意选择和你游戏版本一致的文件。
Item Commander 怎么安装?
先用 PCL2 或 HMCL 启动器安装对应版本的 Fabric / Quilt,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。运行环境:仅服务端。
Camper_Samu 的其他作品
查看全部 →
Server Chat Heads
Use player heads in chat and more via placeholders! Credits to CatDevz for making the original Minestom code.
WAYF? – Where Are You From?
A serverside-only Fabric mod that adds the corresponding mod name to items in the lore
Rings of Flight
A mod that introduces two rings that allow you to fly in a balanced way
评论
登录后评论和评分