|
@@ -3,53 +3,54 @@ package com.umollu.ash;
|
|
|
import com.mojang.brigadier.CommandDispatcher;
|
|
|
import com.mojang.brigadier.arguments.IntegerArgumentType;
|
|
|
import com.umollu.ash.config.AshConfig;
|
|
|
-import io.github.cottonmc.clientcommands.ArgumentBuilders;
|
|
|
-import io.github.cottonmc.clientcommands.ClientCommandPlugin;
|
|
|
-import io.github.cottonmc.clientcommands.CottonClientCommandSource;
|
|
|
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
|
|
|
+import net.fabricmc.fabric.api.client.command.v1.ClientCommandManager;
|
|
|
+import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource;
|
|
|
|
|
|
-public class AshCommands implements ClientCommandPlugin {
|
|
|
+public class AshCommands {
|
|
|
|
|
|
public static AshConfig config;
|
|
|
|
|
|
- @Override
|
|
|
- public void registerCommands(CommandDispatcher<CottonClientCommandSource> commandDispatcher) {
|
|
|
+ public static void registerCommands() {
|
|
|
|
|
|
+ CommandDispatcher<FabricClientCommandSource> commandDispatcher = ClientCommandManager.DISPATCHER;
|
|
|
+
|
|
|
+
|
|
|
if(config == null) {
|
|
|
config = AutoConfig.getConfigHolder(AshConfig.class).getConfig();
|
|
|
}
|
|
|
- commandDispatcher.register(ArgumentBuilders.literal("toggleash")
|
|
|
+ commandDispatcher.register(ClientCommandManager.literal("toggleash")
|
|
|
.executes(context -> {
|
|
|
config.showHud = !config.showHud;
|
|
|
AshMod.configManager.save();
|
|
|
return 1;
|
|
|
}));
|
|
|
|
|
|
- commandDispatcher.register(ArgumentBuilders.literal("togglefps")
|
|
|
+ commandDispatcher.register(ClientCommandManager.literal("togglefps")
|
|
|
.executes(context -> {
|
|
|
config.showFps = !config.showFps;
|
|
|
AshMod.configManager.save();
|
|
|
return 1;
|
|
|
}));
|
|
|
|
|
|
- commandDispatcher.register(ArgumentBuilders.literal("togglecoords")
|
|
|
+ commandDispatcher.register(ClientCommandManager.literal("togglecoords")
|
|
|
.executes(context -> {
|
|
|
config.showCoords = !config.showCoords;
|
|
|
AshMod.configManager.save();
|
|
|
return 1;
|
|
|
}));
|
|
|
|
|
|
- commandDispatcher.register(ArgumentBuilders.literal("toggledirection")
|
|
|
+ commandDispatcher.register(ClientCommandManager.literal("toggledirection")
|
|
|
.executes(context -> {
|
|
|
config.showDirection = !config.showDirection;
|
|
|
AshMod.configManager.save();
|
|
|
return 1;
|
|
|
}));
|
|
|
|
|
|
- commandDispatcher.register(ArgumentBuilders.literal("ashcolor")
|
|
|
- .then(ArgumentBuilders.argument("r", IntegerArgumentType.integer())
|
|
|
- .then(ArgumentBuilders.argument("g", IntegerArgumentType.integer())
|
|
|
- .then(ArgumentBuilders.argument("b", IntegerArgumentType.integer())
|
|
|
+ commandDispatcher.register(ClientCommandManager.literal("ashcolor")
|
|
|
+ .then(ClientCommandManager.argument("r", IntegerArgumentType.integer())
|
|
|
+ .then(ClientCommandManager.argument("g", IntegerArgumentType.integer())
|
|
|
+ .then(ClientCommandManager.argument("b", IntegerArgumentType.integer())
|
|
|
.executes(context -> {
|
|
|
int r = IntegerArgumentType.getInteger(context,"r");
|
|
|
int g = IntegerArgumentType.getInteger(context,"g");
|
|
@@ -60,27 +61,27 @@ public class AshCommands implements ClientCommandPlugin {
|
|
|
return 1;
|
|
|
})))));
|
|
|
|
|
|
- commandDispatcher.register(ArgumentBuilders.literal("resetash")
|
|
|
+ commandDispatcher.register(ClientCommandManager.literal("resetash")
|
|
|
.executes(context -> {
|
|
|
config = new AshConfig();
|
|
|
AshMod.configManager.save();
|
|
|
return 1;
|
|
|
}));
|
|
|
|
|
|
- commandDispatcher.register(ArgumentBuilders.literal("alignash")
|
|
|
- .then(ArgumentBuilders.literal("left")
|
|
|
+ commandDispatcher.register(ClientCommandManager.literal("alignash")
|
|
|
+ .then(ClientCommandManager.literal("left")
|
|
|
.executes(context -> {
|
|
|
config.align = 0;
|
|
|
AshMod.configManager.save();
|
|
|
return 1;
|
|
|
}))
|
|
|
- .then(ArgumentBuilders.literal("center")
|
|
|
+ .then(ClientCommandManager.literal("center")
|
|
|
.executes(context -> {
|
|
|
config.align = 1;
|
|
|
AshMod.configManager.save();
|
|
|
return 1;
|
|
|
}))
|
|
|
- .then(ArgumentBuilders.literal("right")
|
|
|
+ .then(ClientCommandManager.literal("right")
|
|
|
.executes(context -> {
|
|
|
config.align = 2;
|
|
|
AshMod.configManager.save();
|