aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/shcm/shsupercm/fabric/citresewn/CITResewnCommand.java
blob: 483cbfbc3a9c2c221077a6d84ed206573b9ba837 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package shcm.shsupercm.fabric.citresewn;

import net.fabricmc.fabric.api.client.command.v1.ClientCommandManager;
import net.fabricmc.loader.api.FabricLoader;
import shcm.shsupercm.fabric.citresewn.config.CITResewnConfig;

import static net.fabricmc.fabric.api.client.command.v1.ClientCommandManager.literal;
import static net.minecraft.text.Text.of;

public class CITResewnCommand {
    public static boolean openConfig = false;

    public static void register() {
        ClientCommandManager.DISPATCHER.register(literal("citresewn")
                .executes(context -> {
                    context.getSource().sendFeedback(of("CIT Resewn v" + FabricLoader.getInstance().getModContainer("citresewn").get().getMetadata().getVersion() + ":"));
                    boolean active = CITResewnConfig.INSTANCE().enabled && CITResewn.INSTANCE.activeCITs != null;
                    context.getSource().sendFeedback(of("  Active: " + (active ? "yes" : "no")));
                    if (active) {
                        context.getSource().sendFeedback(of("  Loaded: " + CITResewn.INSTANCE.activeCITs.cits.size() + " CITs from " + CITResewn.INSTANCE.activeCITs.packs.size() + " resourcepacks"));
                    }
                    context.getSource().sendFeedback(of("  "));

                    return 1;
                })
                .then(literal("config")
                    .executes(context -> {
                        openConfig = true;

                        return 1;
                    })));
    }
}