Class ResourceOrIdArgument<T>
java.lang.Object
net.minecraft.commands.arguments.ResourceOrIdArgument<T>
- All Implemented Interfaces:
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 Optional<? extends HolderLookup.RegistryLookup<T>> static final DynamicCommandExceptionTypestatic final Dynamic2CommandExceptionTypeprivate static final Collection<String> private final Grammar<ResourceOrIdArgument.Result<T, Tag>> static final DynamicOps<Tag> private final ResourceKey<? extends Registry<T>> private final HolderLookup.Provider -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedResourceOrIdArgument(CommandBuildContext context, ResourceKey<? extends Registry<T>> registryKey, Codec<T> codec) -
Method Summary
Modifier and TypeMethodDescriptionstatic <T,O> Grammar <ResourceOrIdArgument.Result<T, O>> createGrammar(ResourceKey<? extends Registry<T>> registryKey, DynamicOps<O> ops) dialog(CommandBuildContext context) getDialog(CommandContext<CommandSourceStack> context, String name) static Holder<LootItemFunction> getLootModifier(CommandContext<CommandSourceStack> context, String name) static Holder<LootItemCondition> getLootPredicate(CommandContext<CommandSourceStack> context, String name) getLootTable(CommandContext<CommandSourceStack> context, String name) private static <T> Holder<T> getResource(CommandContext<CommandSourceStack> context, String name) listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) lootModifier(CommandBuildContext context) lootPredicate(CommandBuildContext context) lootTable(CommandBuildContext context) parse(StringReader reader) parse(StringReader reader, Grammar<ResourceOrIdArgument.Result<T, O>> grammar, DynamicOps<O> ops) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ArgumentType
parse
-
Field Details
-
EXAMPLES
-
ERROR_FAILED_TO_PARSE
-
ERROR_NO_SUCH_ELEMENT
-
OPS
-
registryLookup
-
elementLookup
-
codec
-
grammar
-
registryKey
-
-
Constructor Details
-
ResourceOrIdArgument
protected ResourceOrIdArgument(CommandBuildContext context, ResourceKey<? extends Registry<T>> registryKey, Codec<T> codec)
-
-
Method Details
-
createGrammar
public static <T,O> Grammar<ResourceOrIdArgument.Result<T,O>> createGrammar(ResourceKey<? extends Registry<T>> registryKey, DynamicOps<O> ops) -
lootTable
-
getLootTable
public static Holder<LootTable> getLootTable(CommandContext<CommandSourceStack> context, String name) throws CommandSyntaxException - Throws:
CommandSyntaxException
-
lootModifier
-
getLootModifier
public static Holder<LootItemFunction> getLootModifier(CommandContext<CommandSourceStack> context, String name) -
lootPredicate
-
getLootPredicate
public static Holder<LootItemCondition> getLootPredicate(CommandContext<CommandSourceStack> context, String name) -
dialog
-
getDialog
-
getResource
-
parse
- Specified by:
parsein interfaceArgumentType<T>- Throws:
CommandSyntaxException
-
parse
private <O> @Nullable Holder<T> parse(StringReader reader, Grammar<ResourceOrIdArgument.Result<T, O>> grammar, DynamicOps<O> ops) throws CommandSyntaxException- Throws:
CommandSyntaxException
-
listSuggestions
public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) - Specified by:
listSuggestionsin interfaceArgumentType<T>
-
getExamples
- Specified by:
getExamplesin interfaceArgumentType<T>
-