personthecat.catlib.command.CatLibCommands Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of catlib-quilt Show documentation
Show all versions of catlib-quilt Show documentation
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());
}
}
}