Migrate the Carpet codebase to Mojang Mappings
This commit is contained in:
346 files changed
+8353
-8492
No files matched your search
@@ -6,34 +6,34 @@ import carpet.utils.MobAI;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import net.minecraft.command.argument.EntitySummonArgumentType;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.arguments.EntitySummonArgument;
|
||||
import net.minecraft.core.Registry;
|
||||
|
||||
import static net.minecraft.server.command.CommandManager.argument;
|
||||
import static net.minecraft.server.command.CommandManager.literal;
|
||||
import static net.minecraft.command.CommandSource.suggestMatching;
|
||||
import static net.minecraft.commands.Commands.argument;
|
||||
import static net.minecraft.commands.Commands.literal;
|
||||
import static net.minecraft.commands.SharedSuggestionProvider.suggest;
|
||||
|
||||
public class MobAICommand
|
||||
{
|
||||
public static void register(CommandDispatcher<ServerCommandSource> dispatcher)
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
||||
{
|
||||
LiteralArgumentBuilder<ServerCommandSource> command = literal("track").
|
||||
LiteralArgumentBuilder<CommandSourceStack> command = literal("track").
|
||||
requires((player) -> SettingsManager.canUseCommand(player, CarpetSettings.commandTrackAI)).
|
||||
then(argument("entity type", EntitySummonArgumentType.entitySummon()).
|
||||
then(argument("entity type", EntitySummonArgument.id()).
|
||||
|
||||
suggests( (c, b) -> suggestMatching(MobAI.availbleTypes(), b)).
|
||||
suggests( (c, b) -> suggest(MobAI.availbleTypes(), b)).
|
||||
then(literal("clear").executes( (c) ->
|
||||
{
|
||||
MobAI.clearTracking(Registry.ENTITY_TYPE.get(EntitySummonArgumentType.getEntitySummon(c, "entity type")));
|
||||
MobAI.clearTracking(Registry.ENTITY_TYPE.get(EntitySummonArgument.getSummonableEntity(c, "entity type")));
|
||||
return 1;
|
||||
}
|
||||
)).
|
||||
then(argument("aspect", StringArgumentType.word()).
|
||||
suggests( (c, b) -> suggestMatching(MobAI.availableFor(Registry.ENTITY_TYPE.get(EntitySummonArgumentType.getEntitySummon(c, "entity type"))),b)).
|
||||
suggests( (c, b) -> suggest(MobAI.availableFor(Registry.ENTITY_TYPE.get(EntitySummonArgument.getSummonableEntity(c, "entity type"))),b)).
|
||||
executes( (c) -> {
|
||||
MobAI.startTracking(
|
||||
Registry.ENTITY_TYPE.get(EntitySummonArgumentType.getEntitySummon(c, "entity type")),
|
||||
Registry.ENTITY_TYPE.get(EntitySummonArgument.getSummonableEntity(c, "entity type")),
|
||||
MobAI.TrackingType.byName(StringArgumentType.getString(c, "aspect"))
|
||||
);
|
||||
return 1;
|
||||
|
||||
Reference in new issue
Block a user