HomeJavaModsItem Commander
Item Commander
ModsJava

Item Commander

by Camper_Samu · on Modrinth

Which build do you need?

This mod ships a separate file for every mod loader and every version of the game. Pick both, then download — the wrong build installs fine and then does nothing in the game.

Mod loader

Minecraft version

⬇ Download for 1.21–1.21.1 · Fabric⬇ Download for 1.20.5–1.20.6 · Fabric⬇ Download for 1.20.3–1.20.4 · Fabric⬇ Download for 1.20–1.20.2 · Fabric⬇ Download for 1.18–1.18.2 · Fabric⬇ Download for 1.21–1.21.1 · Quilt⬇ Download for 1.20.5–1.20.6 · Quilt⬇ Download for 1.20.3–1.20.4 · Quilt⬇ Download for 1.20–1.20.2 · Quilt⬇ Download for 1.18–1.18.2 · Quilt
I don't know my version or loader
Open the Minecraft launcher and look at the profile you play on — it names both, like fabric-loader-1.21.4. The version also shows in the bottom-right corner of the game's main menu.
No loader in the profile name? Then it's plain Minecraft, and these mods won't run — you need Fabric or NeoForge installed first.
Item Commander — screenshot 1

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.

This mod supports LuckPerms' Fabric Permission API.

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.

Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

Verified by MCModsHub

These come from our own check of the pack file, not from the source page.

Explore more