Class TagsCommand

java.lang.Object
net.minecraftforge.server.command.TagsCommand

class TagsCommand extends Object
The /forge tags command for listing a registry's tags, getting the elements of tags, and querying the tags of a registry object.

Each command is paginated, showing 8L entries at a time. When there are more than 0 entries, the text indicating the amount of entries is highlighted and can be clicked to copy the list of all entries (across all pages) to the clipboard. (This is reflected by the use of green text in brackets, mimicking the clickable coordinates in the /locate command's message)

The command has three subcommands:

  • /forge tags <registry> list [page] - Lists all available tags in the given registry.
  • /forge tags <registry> get <tag> [page] - Gets all elements of the given tag in the given registry.
  • /forge tags <registry> query <element> [page] - Queries for all tags in the given registry which contain the given registry object.
  • Field Details

    • PAGE_SIZE

      private static final long PAGE_SIZE
      See Also:
    • ROOT_REGISTRY_KEY

      private static final ResourceKey<Registry<Registry<?>>> ROOT_REGISTRY_KEY
    • UNKNOWN_REGISTRY

      private static final com.mojang.brigadier.exceptions.DynamicCommandExceptionType UNKNOWN_REGISTRY
    • UNKNOWN_TAG

      private static final com.mojang.brigadier.exceptions.Dynamic2CommandExceptionType UNKNOWN_TAG
    • UNKNOWN_ELEMENT

      private static final com.mojang.brigadier.exceptions.Dynamic2CommandExceptionType UNKNOWN_ELEMENT
  • Constructor Details

    • TagsCommand

      TagsCommand()
  • Method Details

    • register

      public static com.mojang.brigadier.builder.ArgumentBuilder<CommandSourceStack,?> register()
    • listTags

      private static int listTags(com.mojang.brigadier.context.CommandContext<CommandSourceStack> ctx, int page) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • listTagElements

      private static int listTagElements(com.mojang.brigadier.context.CommandContext<CommandSourceStack> ctx, int page) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • queryElementTags

      private static int queryElementTags(com.mojang.brigadier.context.CommandContext<CommandSourceStack> ctx, int page) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • createMessage

      private static MutableComponent createMessage(TranslatableComponent header, String containsText, String copyHoverText, long count, long currentPage, ChatFormatting elementColor, Supplier<Stream<String>> names)
    • suggestRegistries

      private static CompletableFuture<com.mojang.brigadier.suggestion.Suggestions> suggestRegistries(com.mojang.brigadier.context.CommandContext<CommandSourceStack> ctx, com.mojang.brigadier.suggestion.SuggestionsBuilder builder)
    • suggestFromRegistry

      private static com.mojang.brigadier.suggestion.SuggestionProvider<CommandSourceStack> suggestFromRegistry(Function<Registry<?>,Iterable<ResourceLocation>> namesFunction)
    • getResourceKey

      private static <T> Optional<ResourceKey<T>> getResourceKey(com.mojang.brigadier.context.CommandContext<CommandSourceStack> ctx, String name, ResourceKey<Registry<T>> registryKey)
    • cast

      private static <O> O cast(Object input)