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.LootModifierArgument
,ResourceOrIdArgument.LootPredicateArgument
,ResourceOrIdArgument.LootTableArgument
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.brigadier.exceptions.DynamicCommandExceptionType
private static final com.mojang.brigadier.exceptions.SimpleCommandExceptionType
private static final Collection
<String> private final boolean
private final HolderLookup.Provider
private static final TagParser
<?> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ResourceOrIdArgument
(CommandBuildContext pRegistryLookup, ResourceKey<Registry<T>> pRegistryKey, com.mojang.serialization.Codec<Holder<T>> pCodec) -
Method Summary
Modifier and TypeMethodDescriptionstatic 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) private static boolean
hasConsumedWholeArg
(com.mojang.brigadier.StringReader pReader) lootModifier
(CommandBuildContext pContext) lootPredicate
(CommandBuildContext pContext) lootTable
(CommandBuildContext pContext) parse
(com.mojang.brigadier.StringReader pReader) (package private) static <T> com.mojang.serialization.Dynamic
<T> parseInlineOrId
(com.mojang.serialization.DynamicOps<T> pOps, TagParser<T> pTagParser, com.mojang.brigadier.StringReader pReader) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.mojang.brigadier.arguments.ArgumentType
listSuggestions, parse
-
Field Details
-
EXAMPLES
-
ERROR_FAILED_TO_PARSE
public static final com.mojang.brigadier.exceptions.DynamicCommandExceptionType ERROR_FAILED_TO_PARSE -
ERROR_INVALID
private static final com.mojang.brigadier.exceptions.SimpleCommandExceptionType ERROR_INVALID -
VALUE_PARSER
-
registryLookup
-
hasRegistry
private final boolean hasRegistry -
codec
-
-
Constructor Details
-
ResourceOrIdArgument
protected ResourceOrIdArgument(CommandBuildContext pRegistryLookup, ResourceKey<Registry<T>> pRegistryKey, com.mojang.serialization.Codec<Holder<T>> pCodec)
-
-
Method Details
-
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) -
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:
parse
in interfacecom.mojang.brigadier.arguments.ArgumentType<T>
- Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
parse
@Nullable private <O> Holder<T> parse(com.mojang.brigadier.StringReader pReader, TagParser<O> pParser) throws com.mojang.brigadier.exceptions.CommandSyntaxException - Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
parseInlineOrId
static <T> com.mojang.serialization.Dynamic<T> parseInlineOrId(com.mojang.serialization.DynamicOps<T> pOps, TagParser<T> pTagParser, com.mojang.brigadier.StringReader pReader) throws com.mojang.brigadier.exceptions.CommandSyntaxException - Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
hasConsumedWholeArg
private static boolean hasConsumedWholeArg(com.mojang.brigadier.StringReader pReader) -
getExamples
- Specified by:
getExamples
in interfacecom.mojang.brigadier.arguments.ArgumentType<T>
-