Unicopia/src/main/java/com/minelittlepony/unicopia/command/Commands.java

41 lines
2.2 KiB
Java
Raw Normal View History

package com.minelittlepony.unicopia.command;
2022-06-25 00:19:55 +02:00
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
2022-08-27 15:07:29 +02:00
import com.minelittlepony.unicopia.Unicopia;
import com.minelittlepony.unicopia.ability.magic.spell.trait.Trait;
import com.minelittlepony.unicopia.client.render.PlayerPoser.Animation;
import com.minelittlepony.unicopia.command.ManaCommand.ManaType;
2022-08-27 15:07:29 +02:00
2022-06-25 00:19:55 +02:00
import net.fabricmc.fabric.api.command.v2.ArgumentTypeRegistry;
import net.fabricmc.loader.api.FabricLoader;
2023-04-30 21:26:31 +02:00
import net.minecraft.command.argument.serialize.ConstantArgumentSerializer;
import net.minecraft.server.MinecraftServer;
public class Commands {
@SuppressWarnings("deprecation")
public static void bootstrap() {
ArgumentTypeRegistry.registerArgumentType(Unicopia.id("animation"), Animation.ArgumentType.class, ConstantArgumentSerializer.of(Animation::argument));
ArgumentTypeRegistry.registerArgumentType(Unicopia.id("animation_recipient"), Animation.Recipient.ArgumentType.class, ConstantArgumentSerializer.of(Animation.Recipient::argument));
ArgumentTypeRegistry.registerArgumentType(Unicopia.id("mana_type"), ManaType.ArgumentType.class, ConstantArgumentSerializer.of(ManaType::argument));
ArgumentTypeRegistry.registerArgumentType(Unicopia.id("trait_type"), Trait.ArgumentType.class, ConstantArgumentSerializer.of(Trait::argument));
ArgumentTypeRegistry.registerArgumentType(Unicopia.id("spell_traits"), TraitsArgumentType.class, ConstantArgumentSerializer.of(TraitsArgumentType::traits));
2023-04-30 21:26:31 +02:00
CommandRegistrationCallback.EVENT.register((dispatcher, registries, environment) -> {
2020-06-26 11:44:47 +02:00
RacelistCommand.register(dispatcher);
EmoteCommand.register(dispatcher);
2023-04-30 21:26:31 +02:00
SpeciesCommand.register(dispatcher, environment);
WorldTribeCommand.register(dispatcher);
GravityCommand.register(dispatcher);
DisguiseCommand.register(dispatcher, registries);
CastCommand.register(dispatcher, registries);
TraitCommand.register(dispatcher);
ManaCommand.register(dispatcher);
if (FabricLoader.getInstance().getGameInstance() instanceof MinecraftServer server) {
server.setFlightEnabled(true);
}
});
}
}