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
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ResourceOrIdArgument
(CommandBuildContext registryLookup, ResourceKey<Registry<T>> registryKey, com.mojang.serialization.Codec<Holder<T>> codec) -
Method Summary
Modifier and TypeMethodDescriptionstatic 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) private static boolean
hasConsumedWholeArg
(com.mojang.brigadier.StringReader reader) lootModifier
(CommandBuildContext context) lootPredicate
(CommandBuildContext context) lootTable
(CommandBuildContext context) parse
(com.mojang.brigadier.StringReader reader) (package private) static Tag
parseInlineOrId
(com.mojang.brigadier.StringReader reader) 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 -
registryLookup
-
hasRegistry
private final boolean hasRegistry -
codec
-
-
Constructor Details
-
ResourceOrIdArgument
protected ResourceOrIdArgument(CommandBuildContext registryLookup, ResourceKey<Registry<T>> registryKey, com.mojang.serialization.Codec<Holder<T>> codec)
-
-
Method Details
-
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) -
getResource
private static <T> Holder<T> getResource(com.mojang.brigadier.context.CommandContext<CommandSourceStack> context, String name) -
parse
@Nullable public Holder<T> parse(com.mojang.brigadier.StringReader reader) throws com.mojang.brigadier.exceptions.CommandSyntaxException - Specified by:
parse
in interfacecom.mojang.brigadier.arguments.ArgumentType<T>
- Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
parseInlineOrId
static Tag parseInlineOrId(com.mojang.brigadier.StringReader reader) throws com.mojang.brigadier.exceptions.CommandSyntaxException - Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
hasConsumedWholeArg
private static boolean hasConsumedWholeArg(com.mojang.brigadier.StringReader reader) -
getExamples
- Specified by:
getExamples
in interfacecom.mojang.brigadier.arguments.ArgumentType<T>
-