Package net.minecraft.commands.arguments
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 pRegistryLookup, ResourceKey<? extends Registry<T>> pRegistryKey, com.mojang.serialization.Codec<T> pCodec) -
Method Summary
Modifier and TypeMethodDescriptionstatic <T,O> Grammar <ResourceOrIdArgument.Result<T, O>> createGrammar(ResourceKey<? extends Registry<T>> pRegistryKey, com.mojang.serialization.DynamicOps<O> pOps) dialog(CommandBuildContext pContext) getDialog(com.mojang.brigadier.context.CommandContext<CommandSourceStack> pContext, String pName) static Holder<LootItemFunction> getLootModifier(com.mojang.brigadier.context.CommandContext<CommandSourceStack> pContext, String pName) static Holder<LootItemCondition> getLootPredicate(com.mojang.brigadier.context.CommandContext<CommandSourceStack> pContext, String pName) getLootTable(com.mojang.brigadier.context.CommandContext<CommandSourceStack> pContext, String pName) private static <T> Holder<T> getResource(com.mojang.brigadier.context.CommandContext<CommandSourceStack> pContext, String pName) <S> CompletableFuture<com.mojang.brigadier.suggestion.Suggestions> listSuggestions(com.mojang.brigadier.context.CommandContext<S> pContext, com.mojang.brigadier.suggestion.SuggestionsBuilder pBuilder) lootModifier(CommandBuildContext pContext) lootPredicate(CommandBuildContext pContext) lootTable(CommandBuildContext pContext) parse(com.mojang.brigadier.StringReader pReader) parse(com.mojang.brigadier.StringReader pReader, Grammar<ResourceOrIdArgument.Result<T, O>> pGrammar, com.mojang.serialization.DynamicOps<O> pOps) 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_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 pRegistryLookup, ResourceKey<? extends Registry<T>> pRegistryKey, com.mojang.serialization.Codec<T> pCodec)
-
-
Method Details
-
createGrammar
public static <T,O> Grammar<ResourceOrIdArgument.Result<T,O>> createGrammar(ResourceKey<? extends Registry<T>> pRegistryKey, com.mojang.serialization.DynamicOps<O> pOps) -
lootTable
-
getLootTable
public static Holder<LootTable> getLootTable(com.mojang.brigadier.context.CommandContext<CommandSourceStack> pContext, String pName) 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> pContext, String pName) -
lootPredicate
public static ResourceOrIdArgument.LootPredicateArgument lootPredicate(CommandBuildContext pContext) -
getLootPredicate
public static Holder<LootItemCondition> getLootPredicate(com.mojang.brigadier.context.CommandContext<CommandSourceStack> pContext, String pName) -
dialog
-
getDialog
public static Holder<Dialog> getDialog(com.mojang.brigadier.context.CommandContext<CommandSourceStack> pContext, String pName) -
getResource
private static <T> Holder<T> getResource(com.mojang.brigadier.context.CommandContext<CommandSourceStack> pContext, String pName) -
parse
@Nullable public Holder<T> parse(com.mojang.brigadier.StringReader pReader) throws com.mojang.brigadier.exceptions.CommandSyntaxException - Specified by:
parsein interfacecom.mojang.brigadier.arguments.ArgumentType<T>- Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
parse
@Nullable private <O> Holder<T> parse(com.mojang.brigadier.StringReader pReader, Grammar<ResourceOrIdArgument.Result<T, O>> pGrammar, com.mojang.serialization.DynamicOps<O> pOps) 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> pContext, com.mojang.brigadier.suggestion.SuggestionsBuilder pBuilder) - Specified by:
listSuggestionsin interfacecom.mojang.brigadier.arguments.ArgumentType<T>
-
getExamples
- Specified by:
getExamplesin interfacecom.mojang.brigadier.arguments.ArgumentType<T>
-