Class CommandUtils
java.lang.Object
net.neoforged.neoforge.server.command.CommandUtils
Utility class for various command-related operations.
For modders and NeoForge to both use.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Optional
<net.minecraft.resources.ResourceKey<T>> getResourceKey
(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> ctx, String name, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<T>> registryKey) static net.minecraft.network.chat.MutableComponent
static net.minecraft.network.chat.MutableComponent
makeTranslatableWithFallback
(String key, Object... args) static <T extends net.minecraft.core.Registry<?>>
com.mojang.brigadier.suggestion.SuggestionProvider<net.minecraft.commands.CommandSourceStack> suggestFromRegistry
(Function<net.minecraft.core.Registry<?>, Iterable<net.minecraft.resources.ResourceLocation>> namesFunction, String argumentString, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<T>> registryKey) static CompletableFuture
<com.mojang.brigadier.suggestion.Suggestions> suggestRegistries
(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> ctx, com.mojang.brigadier.suggestion.SuggestionsBuilder builder)
-
Constructor Details
-
CommandUtils
private CommandUtils()
-
-
Method Details
-
suggestRegistries
public static CompletableFuture<com.mojang.brigadier.suggestion.Suggestions> suggestRegistries(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> ctx, com.mojang.brigadier.suggestion.SuggestionsBuilder builder) -
suggestFromRegistry
public static <T extends net.minecraft.core.Registry<?>> com.mojang.brigadier.suggestion.SuggestionProvider<net.minecraft.commands.CommandSourceStack> suggestFromRegistry(Function<net.minecraft.core.Registry<?>, Iterable<net.minecraft.resources.ResourceLocation>> namesFunction, String argumentString, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<T>> registryKey) -
getResourceKey
-
makeTranslatableWithFallback
-
makeTranslatableWithFallback
-