Replaced by the client-sided command API in Fabric Command API v1 1.1.0.
A Minecraft library for 1.14 to 1.16 that adds support for client-side commands.
This mod is open source and under a permissive license. As such, it can be included in any modpack on any platform without prior permission. We appreciate hearing about people using our mods, but you do not need to ask to use them. See the LICENSE file for more details.
Add a dependency in your build.gradle
or build.gradle.kts
:
repositories {
maven {
name = 'CottonMC'
url = 'https://server.bbkr.space/artifactory/libs-release'
}
}
dependencies {
modImplementation "io.github.cottonmc:cotton-client-commands:<latest version>"
}
build.gradle.kts
repositories {
maven {
name = "CottonMC"
url = uri("https://server.bbkr.space/artifactory/libs-release")
}
}
dependencies {
modImplementation("io.github.cottonmc:cotton-client-commands:<latest version>")
}
Register the commands with a ClientCommandPlugin
:
import com.mojang.brigadier.CommandDispatcher;
import io.github.cottonmc.clientcommands.*;
import net.minecraft.server.command.CommandSource;
import net.minecraft.text.LiteralText;
public class MyCommands implements ClientCommandPlugin {
@Override
public void registerCommands(CommandDispatcher<CottonClientCommandSource> dispatcher) {
dispatcher.register(ArgumentBuilders.literal("client-commands").executes(
source -> {
source.getSource().sendFeedback(new LiteralText("Hello, world!"));
return 1;
}
));
}
}
And finally, add the dependency and register the plugin entrypoint in your fabric.mod.json
:
{
"depends": {
"cotton-client-commands": "^1.0.0"
},
"entrypoints": {
"cotton-client-commands": ["path.to.MyCommands"]
}
}
The classes ArgumentBuilders
and CottonClientCommandSource
are provided as
alternatives to CommandManager
and ServerCommandSource
.