All Downloads are FREE. Search and download functionalities are using the official Maven repository.

personthecat.catlib.command.CatLibCommands Maven / Gradle / Ivy

Go to download

Utilities for serialization, commands, noise generation, IO, and some new data types.

The newest version!
package personthecat.catlib.command;

import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.class_124;
import net.minecraft.class_2583;
import net.minecraft.class_2588;
import personthecat.catlib.client.gui.LibErrorMenu;
import personthecat.catlib.event.error.LibErrorContext;
import personthecat.catlib.util.LibReference;

public class CatLibCommands {

    public static final LibCommandBuilder ERROR_MENU =
        LibCommandBuilder.named("errors")
            .description("Opens the error menu.")
            .side(CommandSide.CLIENT)
            .mod(LibReference.MOD_DESCRIPTOR)
            .generate((builder, utl) ->
                builder.executes(utl.wrap(CatLibCommands::displayErrors)));

    @Environment(EnvType.CLIENT)
    private static void displayErrors(final CommandContextWrapper ctx) {
        if (!LibErrorContext.hasErrors()) {
            ctx.sendMessage(new class_2588("catlib.errorText.noErrors")
                .method_27696(class_2583.field_24360.method_10977(class_124.field_1060)));
        } else {
            ctx.setScreen(new LibErrorMenu(null).loadImmediately());
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy