Class EntityArgument
java.lang.Object
net.minecraft.commands.arguments.EntityArgument
- All Implemented Interfaces:
ArgumentType<EntitySelector>
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SimpleCommandExceptionTypestatic final SimpleCommandExceptionTypestatic final SimpleCommandExceptionTypestatic final SimpleCommandExceptionTypeprivate static final Collection<String> static final SimpleCommandExceptionTypestatic final SimpleCommandExceptionTypeprivate final booleanprivate final boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic EntityArgumententities()static EntityArgumententity()static Collection<? extends Entity> getEntities(CommandContext<CommandSourceStack> context, String name) static EntitygetEntity(CommandContext<CommandSourceStack> context, String name) static Collection<? extends Entity> getOptionalEntities(CommandContext<CommandSourceStack> context, String name) static Collection<ServerPlayer> getOptionalPlayers(CommandContext<CommandSourceStack> context, String name) static ServerPlayergetPlayer(CommandContext<CommandSourceStack> context, String name) static Collection<ServerPlayer> getPlayers(CommandContext<CommandSourceStack> context, String name) listSuggestions(CommandContext<S> contextBuilder, SuggestionsBuilder builder) parse(StringReader reader) private EntitySelectorparse(StringReader reader, boolean allowSelectors) <S> EntitySelectorparse(StringReader reader, S source) static EntityArgumentplayer()static EntityArgumentplayers()
-
Field Details
-
EXAMPLES
-
ERROR_NOT_SINGLE_ENTITY
-
ERROR_NOT_SINGLE_PLAYER
-
ERROR_ONLY_PLAYERS_ALLOWED
-
NO_ENTITIES_FOUND
-
NO_PLAYERS_FOUND
-
ERROR_SELECTORS_NOT_ALLOWED
-
single
private final boolean single -
playersOnly
private final boolean playersOnly
-
-
Constructor Details
-
EntityArgument
protected EntityArgument(boolean single, boolean playersOnly)
-
-
Method Details
-
entity
-
getEntity
public static Entity getEntity(CommandContext<CommandSourceStack> context, String name) throws CommandSyntaxException - Throws:
CommandSyntaxException
-
entities
-
getEntities
public static Collection<? extends Entity> getEntities(CommandContext<CommandSourceStack> context, String name) throws CommandSyntaxException - Throws:
CommandSyntaxException
-
getOptionalEntities
public static Collection<? extends Entity> getOptionalEntities(CommandContext<CommandSourceStack> context, String name) throws CommandSyntaxException - Throws:
CommandSyntaxException
-
getOptionalPlayers
public static Collection<ServerPlayer> getOptionalPlayers(CommandContext<CommandSourceStack> context, String name) throws CommandSyntaxException - Throws:
CommandSyntaxException
-
player
-
getPlayer
public static ServerPlayer getPlayer(CommandContext<CommandSourceStack> context, String name) throws CommandSyntaxException - Throws:
CommandSyntaxException
-
players
-
getPlayers
public static Collection<ServerPlayer> getPlayers(CommandContext<CommandSourceStack> context, String name) throws CommandSyntaxException - Throws:
CommandSyntaxException
-
parse
- Specified by:
parsein interfaceArgumentType<EntitySelector>- Throws:
CommandSyntaxException
-
parse
- Specified by:
parsein interfaceArgumentType<EntitySelector>- Throws:
CommandSyntaxException
-
parse
private EntitySelector parse(StringReader reader, boolean allowSelectors) throws CommandSyntaxException - Throws:
CommandSyntaxException
-
listSuggestions
public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> contextBuilder, SuggestionsBuilder builder) - Specified by:
listSuggestionsin interfaceArgumentType<EntitySelector>
-
getExamples
- Specified by:
getExamplesin interfaceArgumentType<EntitySelector>
-