Class ResourceArgument<T>
java.lang.Object
net.minecraft.commands.arguments.ResourceArgument<T>
- All Implemented Interfaces:
ArgumentType<Holder.Reference<T>>
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Dynamic3CommandExceptionTypeprivate static final DynamicCommandExceptionTypestatic final Dynamic2CommandExceptionTypeprivate static final Collection<String> private final ResourceKey<? extends Registry<T>> private final HolderLookup<T> -
Constructor Summary
ConstructorsConstructorDescriptionResourceArgument(CommandBuildContext context, ResourceKey<? extends Registry<T>> registryKey) -
Method Summary
Modifier and TypeMethodDescriptionstatic Holder.Reference<Attribute> getAttribute(CommandContext<CommandSourceStack> context, String name) static Holder.Reference<WorldClock> getClock(CommandContext<CommandSourceStack> context, String name) static Holder.Reference<ConfiguredFeature<?, ?>> getConfiguredFeature(CommandContext<CommandSourceStack> context, String name) static Holder.Reference<Enchantment> getEnchantment(CommandContext<CommandSourceStack> context, String name) static Holder.Reference<EntityType<?>> getEntityType(CommandContext<CommandSourceStack> context, String name) static Holder.Reference<MobEffect> getMobEffect(CommandContext<CommandSourceStack> context, String name) static <T> Holder.Reference<T> getResource(CommandContext<CommandSourceStack> context, String name, ResourceKey<Registry<T>> registryKey) static Holder.Reference<Structure> getStructure(CommandContext<CommandSourceStack> context, String name) static Holder.Reference<EntityType<?>> getSummonableEntityType(CommandContext<CommandSourceStack> context, String name) static Holder.Reference<Timeline> getTimeline(CommandContext<CommandSourceStack> context, String name) listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) parse(StringReader reader) static <T> ResourceArgument<T> resource(CommandBuildContext context, ResourceKey<? extends Registry<T>> key) 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_NOT_SUMMONABLE_ENTITY
-
ERROR_UNKNOWN_RESOURCE
-
ERROR_INVALID_RESOURCE_TYPE
-
registryKey
-
registryLookup
-
-
Constructor Details
-
ResourceArgument
public ResourceArgument(CommandBuildContext context, ResourceKey<? extends Registry<T>> registryKey)
-
-
Method Details
-
resource
public static <T> ResourceArgument<T> resource(CommandBuildContext context, ResourceKey<? extends Registry<T>> key) -
getResource
public static <T> Holder.Reference<T> getResource(CommandContext<CommandSourceStack> context, String name, ResourceKey<Registry<T>> registryKey) throws CommandSyntaxException - Throws:
CommandSyntaxException
-
getAttribute
public static Holder.Reference<Attribute> getAttribute(CommandContext<CommandSourceStack> context, String name) throws CommandSyntaxException - Throws:
CommandSyntaxException
-
getConfiguredFeature
public static Holder.Reference<ConfiguredFeature<?,?>> getConfiguredFeature(CommandContext<CommandSourceStack> context, String name) throws CommandSyntaxException - Throws:
CommandSyntaxException
-
getStructure
public static Holder.Reference<Structure> getStructure(CommandContext<CommandSourceStack> context, String name) throws CommandSyntaxException - Throws:
CommandSyntaxException
-
getEntityType
public static Holder.Reference<EntityType<?>> getEntityType(CommandContext<CommandSourceStack> context, String name) throws CommandSyntaxException - Throws:
CommandSyntaxException
-
getSummonableEntityType
public static Holder.Reference<EntityType<?>> getSummonableEntityType(CommandContext<CommandSourceStack> context, String name) throws CommandSyntaxException - Throws:
CommandSyntaxException
-
getMobEffect
public static Holder.Reference<MobEffect> getMobEffect(CommandContext<CommandSourceStack> context, String name) throws CommandSyntaxException - Throws:
CommandSyntaxException
-
getEnchantment
public static Holder.Reference<Enchantment> getEnchantment(CommandContext<CommandSourceStack> context, String name) throws CommandSyntaxException - Throws:
CommandSyntaxException
-
getClock
public static Holder.Reference<WorldClock> getClock(CommandContext<CommandSourceStack> context, String name) throws CommandSyntaxException - Throws:
CommandSyntaxException
-
getTimeline
public static Holder.Reference<Timeline> getTimeline(CommandContext<CommandSourceStack> context, String name) throws CommandSyntaxException - Throws:
CommandSyntaxException
-
parse
- Specified by:
parsein interfaceArgumentType<T>- Throws:
CommandSyntaxException
-
listSuggestions
public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) - Specified by:
listSuggestionsin interfaceArgumentType<T>
-
getExamples
- Specified by:
getExamplesin interfaceArgumentType<T>
-