SPC Babric - Single Player Commands for Babric (b1.7.3)

This mod provides an advanced command system that works not only in single player but also on servers. It features a flexible API for developers and doesn't require additional dependencies for basic functionality.
Additional Features
Optional dependencies are available to extend functionality:
- Install STAPI to access /tp command with dimension support
- BHCreative is required to use the /gamemode command
Command Help
A complete list of available commands can be viewed directly in the game using the /help command.
Developer API
Important: It's recommended to make SPC an optional dependency!
Adding to build.gradle:
repositories {
maven {
name = "Jitpack"
url "https://jitpack.io/"
}
}
dependencies {
modImplementation('com.github.matthewperiut:spc-babric:0.4.3') {
transitive false
}
}
In fabric.mod.json:
"suggests": {
"spc": "*"
},
In mod initialization code:
public static void init_of_some_sort()
{
if (FabricLoader.getInstance().isModLoaded("spc")){
MyModsCommands.add();
}
}
Implement the com.matthewperiut.api.Command interface and register the command through com.matthewperiut.api.CommandRegistry using the call CommandRegistry.add(new Command()), where instead of new Command() you substitute your custom command.
Adding Summon Commands for Your Own Entities
Use com.matthewperiut.api.SummonRegistry and the SummonRegistry.add(...) method
Examples from com.matthewperiut.spc.util.VanillaMobs:
SummonRegistry.add(Creeper.class, (level, pos, param) -> {
Creeper creeper = new Creeper(level);
if (param.length > 5)
if (!param[5].isEmpty())
if (param[5].charAt(0) != '0')
((EntityAccessor) creeper).getDataTracker().setInt(17, (byte) 1);
return creeper;
}, "{charged (0 or 1)}");
SummonRegistry.add(Sheep.class, (level, pos, param) -> {
int color = Integer.parseInt(param[5]);
int has_wool = 1;
if (param.length > 6)
has_wool = Integer.parseInt(param[6]);
Sheep sheep = new Sheep(level);
sheep.setSheared(has_wool == 0);
sheep.setColour(color);
return sheep;
}, "{wool color meta} {has wool (0/1)} ");