Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cottonmc/clientcommands
A Minecraft mod that adds support for client-side commands.
https://github.com/cottonmc/clientcommands
commands fabricmc fabricmc-mod minecraft-mod
Last synced: 18 days ago
JSON representation
A Minecraft mod that adds support for client-side commands.
- Host: GitHub
- URL: https://github.com/cottonmc/clientcommands
- Owner: CottonMC
- License: mit
- Archived: true
- Created: 2019-01-14T19:44:49.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-02-28T00:37:59.000Z (almost 4 years ago)
- Last Synced: 2024-09-26T20:03:50.870Z (4 months ago)
- Topics: commands, fabricmc, fabricmc-mod, minecraft-mod
- Language: Java
- Size: 102 KB
- Stars: 21
- Watchers: 6
- Forks: 7
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cotton Client Commands
[![Maven metadata URL](https://img.shields.io/maven-metadata/v/https/server.bbkr.space:8081/artifactory/libs-release/io/github/cottonmc/cotton-client-commands/maven-metadata.xml.svg)](https://server.bbkr.space:8081/artifactory/libs-release/io/github/cottonmc/cotton-client-commands)
[>> Downloads <<](https://github.com/CottonMC/ClientCommands/releases)
**Replaced by the client-sided command API in [Fabric Command API v1 1.1.0](https://github.com/FabricMC/fabric).**
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](LICENSE) for more details.
## Usage
Add a dependency in your `build.gradle` or `build.gradle.kts`:
```groovy
repositories {
maven {
name = 'CottonMC'
url = 'https://server.bbkr.space/artifactory/libs-release'
}
}dependencies {
modImplementation "io.github.cottonmc:cotton-client-commands:"
}
```build.gradle.kts
```kotlin
repositories {
maven {
name = "CottonMC"
url = uri("https://server.bbkr.space/artifactory/libs-release")
}
}dependencies {
modImplementation("io.github.cottonmc:cotton-client-commands:")
}
```Register the commands with a `ClientCommandPlugin`:
```java
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 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`:
```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`.