Class ResourceOrIdArgument<T>
java.lang.Object
net.minecraft.commands.arguments.ResourceOrIdArgument<T>
- All Implemented Interfaces:
com.mojang.brigadier.arguments.ArgumentType<Holder<T>>
- Direct Known Subclasses:
ResourceOrIdArgument.DialogArgument, ResourceOrIdArgument.LootModifierArgument, ResourceOrIdArgument.LootPredicateArgument, ResourceOrIdArgument.LootTableArgument
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic final recordstatic classstatic classstatic classstatic final recordstatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final com.mojang.serialization.Codec<T> private final Optional<? extends HolderLookup.RegistryLookup<T>> static final com.mojang.brigadier.exceptions.DynamicCommandExceptionTypestatic final com.mojang.brigadier.exceptions.Dynamic2CommandExceptionTypeprivate static final Collection<String> private final Grammar<ResourceOrIdArgument.Result<T, Tag>> static final com.mojang.serialization.DynamicOps<Tag> private final ResourceKey<? extends Registry<T>> private final HolderLookup.Provider -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedResourceOrIdArgument(CommandBuildContext context, ResourceKey<? extends Registry<T>> registryKey, com.mojang.serialization.Codec<T> codec) -
Method Summary
Modifier and TypeMethodDescriptionstatic <T,O> Grammar <ResourceOrIdArgument.Result<T, O>> createGrammar(ResourceKey<? extends Registry<T>> registryKey, com.mojang.serialization.DynamicOps<O> ops) dialog(CommandBuildContext context) getDialog(com.mojang.brigadier.context.CommandContext<CommandSourceStack> context, String name) static Holder<LootItemFunction> getLootModifier(com.mojang.brigadier.context.CommandContext<CommandSourceStack> context, String name) static Holder<LootItemCondition> getLootPredicate(com.mojang.brigadier.context.CommandContext<CommandSourceStack> context, String name) getLootTable(com.mojang.brigadier.context.CommandContext<CommandSourceStack> context, String name) private static <T> Holder<T> getResource(com.mojang.brigadier.context.CommandContext<CommandSourceStack> context, String name) <S> CompletableFuture<com.mojang.brigadier.suggestion.Suggestions> listSuggestions(com.mojang.brigadier.context.CommandContext<S> context, com.mojang.brigadier.suggestion.SuggestionsBuilder builder) lootModifier(CommandBuildContext context) lootPredicate(CommandBuildContext context) lootTable(CommandBuildContext context) parse(com.mojang.brigadier.StringReader reader) parse(com.mojang.brigadier.StringReader reader, Grammar<ResourceOrIdArgument.Result<T, O>> grammar, com.mojang.serialization.DynamicOps<O> ops) Methods inherited from class 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_FAILED_TO_PARSE
public static final com.mojang.brigadier.exceptions.DynamicCommandExceptionType ERROR_FAILED_TO_PARSE -
ERROR_NO_SUCH_ELEMENT
public static final com.mojang.brigadier.exceptions.Dynamic2CommandExceptionType ERROR_NO_SUCH_ELEMENT -
OPS
-
registryLookup
-
elementLookup
-
codec
-
grammar
-
registryKey
-
-
Constructor Details
-
ResourceOrIdArgument
protected ResourceOrIdArgument(CommandBuildContext context, ResourceKey<? extends Registry<T>> registryKey, com.mojang.serialization.Codec<T> codec)
-
-
Method Details
-
createGrammar
public static <T,O> Grammar<ResourceOrIdArgument.Result<T,O>> createGrammar(ResourceKey<? extends Registry<T>> registryKey, com.mojang.serialization.DynamicOps<O> ops) -
lootTable
-
getLootTable
public static Holder<LootTable> getLootTable(com.mojang.brigadier.context.CommandContext<CommandSourceStack> context, String name) throws com.mojang.brigadier.exceptions.CommandSyntaxException - Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
lootModifier
-
getLootModifier
public static Holder<LootItemFunction> getLootModifier(com.mojang.brigadier.context.CommandContext<CommandSourceStack> context, String name) -
lootPredicate
-
getLootPredicate
public static Holder<LootItemCondition> getLootPredicate(com.mojang.brigadier.context.CommandContext<CommandSourceStack> context, String name) -
dialog
-
getDialog
public static Holder<Dialog> getDialog(com.mojang.brigadier.context.CommandContext<CommandSourceStack> context, String name) -
getResource
private static <T> Holder<T> getResource(com.mojang.brigadier.context.CommandContext<CommandSourceStack> context, String name) -
parse
-
parse
private <O> @Nullable Holder<T> parse(com.mojang.brigadier.StringReader reader, Grammar<ResourceOrIdArgument.Result<T, O>> grammar, com.mojang.serialization.DynamicOps<O> ops) throws com.mojang.brigadier.exceptions.CommandSyntaxException- Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
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>
-