Class RegistryEntryParser<C,V>
java.lang.Object
org.incendo.cloud.minecraft.modded.parser.RegistryEntryParser<C,V>
- Type Parameters:
C- the command sender typeV- the registry entry type
- All Implemented Interfaces:
ArgumentParser<C,V>, BlockingSuggestionProvider<C>, BlockingSuggestionProvider.Strings<C>, SuggestionProvider<C>, SuggestionProviderHolder<C>
public final class RegistryEntryParser<C,V>
extends Object
implements ArgumentParser<C,V>, BlockingSuggestionProvider.Strings<C>
Argument for getting a values from a
Registry.
Both static and dynamic registries are supported.
-
Nested Class Summary
Nested classes/interfaces inherited from interface ArgumentParser
ArgumentParser.FutureArgumentParser<C,T> Nested classes/interfaces inherited from interface BlockingSuggestionProvider
BlockingSuggestionProvider.Strings<C> -
Constructor Summary
ConstructorsConstructorDescriptionRegistryEntryParser(@NonNull net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<V>> registry) Create a registry entry parser. -
Method Summary
Modifier and TypeMethodDescriptionparse(@NonNull CommandContext<@NonNull C> commandContext, @NonNull CommandInput commandInput) static <C,V> @NonNull CommandComponent.Builder <C, V> registryEntryComponent(@NonNull net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<V>> registry, @NonNull TypeToken<V> valueType) Returns aCommandComponent.BuilderusingregistryEntryParser(ResourceKey, TypeToken)as the parser.static <C,V> @NonNull ParserDescriptor <C, V> registryEntryParser(@NonNull net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<V>> registry, @NonNull TypeToken<V> valueType) Creates a new registry entry parser.static <C,V> @NonNull ParserDescriptor <C, V> registryEntryParser(@NonNull net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<V>> registry, @NonNull Class<V> valueType) Creates a new registry entry parser.net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>> Get the registry key the parser is using.stringSuggestions(@NonNull CommandContext<C> commandContext, @NonNull CommandInput input) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ArgumentParser
flatMap, flatMapSuccess, mapSuccess, parseFuture, suggestionProviderMethods inherited from interface BlockingSuggestionProvider
suggestionsFutureMethods inherited from interface BlockingSuggestionProvider.Strings
suggestions
-
Constructor Details
-
RegistryEntryParser
-
-
Method Details
-
registryEntryParser
public static <C,V> @NonNull ParserDescriptor<C,V> registryEntryParser(@NonNull net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<V>> registry, @NonNull TypeToken<V> valueType) Creates a new registry entry parser.- Type Parameters:
C- command sender typeV- the registry entry type- Parameters:
registry- the registry key to usevalueType- the value type of output- Returns:
- the created parser
-
registryEntryParser
public static <C,V> @NonNull ParserDescriptor<C,V> registryEntryParser(@NonNull net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<V>> registry, @NonNull Class<V> valueType) Creates a new registry entry parser.- Type Parameters:
C- command sender typeV- the registry entry type- Parameters:
registry- the registry key to usevalueType- the value type of output- Returns:
- the created parser
-
registryEntryComponent
public static <C,V> @NonNull CommandComponent.Builder<C,V> registryEntryComponent(@NonNull net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<V>> registry, @NonNull TypeToken<V> valueType) Returns aCommandComponent.BuilderusingregistryEntryParser(ResourceKey, TypeToken)as the parser.- Type Parameters:
C- the command sender typeV- the registry entry type- Parameters:
registry- the registry key to usevalueType- the value type of output- Returns:
- the component builder
-
parse
public @NonNull ArgumentParseResult<@NonNull V> parse(@NonNull CommandContext<@NonNull C> commandContext, @NonNull CommandInput commandInput) - Specified by:
parsein interfaceArgumentParser<C,V>
-
stringSuggestions
public @NonNull Iterable<@NonNull String> stringSuggestions(@NonNull CommandContext<C> commandContext, @NonNull CommandInput input) - Specified by:
stringSuggestionsin interfaceBlockingSuggestionProvider.Strings<C>
-
registryKey
public net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>> registryKey()Get the registry key the parser is using.- Returns:
- the associated registry key
-