Package net.minecraft.commands.arguments
Class ResourceSelectorArgument<T>
java.lang.Object
net.minecraft.commands.arguments.ResourceSelectorArgument<T>
- All Implemented Interfaces:
com.mojang.brigadier.arguments.ArgumentType<Collection<Holder.Reference<T>>>
public class ResourceSelectorArgument<T>
extends Object
implements com.mojang.brigadier.arguments.ArgumentType<Collection<Holder.Reference<T>>>
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.brigadier.exceptions.Dynamic2CommandExceptionTypeprivate static final Collection<String> (package private) final ResourceKey<? extends Registry<T>> private final HolderLookup<T> -
Constructor Summary
ConstructorsConstructorDescriptionResourceSelectorArgument(CommandBuildContext buildContext, ResourceKey<? extends Registry<T>> registryKey) -
Method Summary
Modifier and TypeMethodDescriptionprivate static StringensureNamespaced(String name) static <T> Collection<Holder.Reference<T>> getSelectedResources(com.mojang.brigadier.context.CommandContext<CommandSourceStack> context, String argument, ResourceKey<? extends Registry<T>> registryKey) private static booleanisAllowedPatternCharacter(char c) <S> CompletableFuture<com.mojang.brigadier.suggestion.Suggestions> listSuggestions(com.mojang.brigadier.context.CommandContext<S> context, com.mojang.brigadier.suggestion.SuggestionsBuilder builder) private static booleanmatches(String string, ResourceLocation location) parse(com.mojang.brigadier.StringReader p_397392_) static <T> Collection<Holder.Reference<T>> parse(com.mojang.brigadier.StringReader parse, HolderLookup<T> lookup) private static StringreadPattern(com.mojang.brigadier.StringReader reader) static <T> ResourceSelectorArgument<T> resourceSelector(CommandBuildContext buildContext, ResourceKey<? extends Registry<T>> registryKey) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.mojang.brigadier.arguments.ArgumentType
parse
-
Field Details
-
EXAMPLES
-
ERROR_NO_MATCHES
public static final com.mojang.brigadier.exceptions.Dynamic2CommandExceptionType ERROR_NO_MATCHES -
registryKey
-
registryLookup
-
-
Constructor Details
-
ResourceSelectorArgument
ResourceSelectorArgument(CommandBuildContext buildContext, ResourceKey<? extends Registry<T>> registryKey)
-
-
Method Details
-
parse
public Collection<Holder.Reference<T>> parse(com.mojang.brigadier.StringReader p_397392_) throws com.mojang.brigadier.exceptions.CommandSyntaxException - Specified by:
parsein interfacecom.mojang.brigadier.arguments.ArgumentType<T>- Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
parse
public static <T> Collection<Holder.Reference<T>> parse(com.mojang.brigadier.StringReader parse, HolderLookup<T> lookup) -
readPattern
-
isAllowedPatternCharacter
private static boolean isAllowedPatternCharacter(char c) -
ensureNamespaced
-
matches
-
resourceSelector
public static <T> ResourceSelectorArgument<T> resourceSelector(CommandBuildContext buildContext, ResourceKey<? extends Registry<T>> registryKey) -
getSelectedResources
public static <T> Collection<Holder.Reference<T>> getSelectedResources(com.mojang.brigadier.context.CommandContext<CommandSourceStack> context, String argument, ResourceKey<? extends Registry<T>> registryKey) -
listSuggestions
public <S> CompletableFuture<com.mojang.brigadier.suggestion.Suggestions> listSuggestions(com.mojang.brigadier.context.CommandContext<S> context, com.mojang.brigadier.suggestion.SuggestionsBuilder builder) - Specified by:
listSuggestionsin interfacecom.mojang.brigadier.arguments.ArgumentType<T>
-
getExamples
- Specified by:
getExamplesin interfacecom.mojang.brigadier.arguments.ArgumentType<T>
-