I've been working on a Minecraft Fabric mod where I initially used CommandManager, and everything was functioning correctly. However, I decided to transition to ClientCommandManager to make the command client-side. After making this change, I encountered errors when trying to run the client and build the project.

Here's the code snippet where I made the switch:


import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;

public class CrackTiers implements ModInitializer {

    @Override
    public void onInitialize() {
        ClientCommandRegistrationCallback.EVENT
                .register((dispatcher, registryAccess) ->
                        dispatcher.register(ClientCommandManager.literal("cracktiers")
                                .then(ClientCommandManager.argument("name", StringArgumentType.word())
                                        .then(ClientCommandManager.argument("mode", StringArgumentType.word())
                                                .executes(context -> {
                                  
                                                    return 1;
                                                })))));

    }

}

I've tried several solutions, including deleting the Gradle file, using genSources again, and running ./gradlew clean and ./gradlew genSources. Unfortunately, none of these steps resolved the issue.

In addition to fixing the build issues, I would also like to make this command work on servers. Any help or guidance on resolving these issues would be greatly appreciated.

0

There are 0 best solutions below