Class CommandUtils

java.lang.Object
net.neoforged.neoforge.server.command.CommandUtils

public final class CommandUtils extends Object
Utility class for various command-related operations.

For modders and NeoForge to both use.

  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <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
     
    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)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public static <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)
    • makeTranslatableWithFallback

      public static net.minecraft.network.chat.MutableComponent makeTranslatableWithFallback(String key, Object... args)
    • makeTranslatableWithFallback

      public static net.minecraft.network.chat.MutableComponent makeTranslatableWithFallback(String key)