I'm wondering if there is a way to kill the closest entity? Kind of like @p gets closest player, how can i use @e to get closest entitie?
@e does not support closest entity. You can reduce the selection to a radius if you'd prefer:
/kill @e[type=Creeper,r=30]
There is the "count" parameter, but this only selects entities based on when they came into existence, not where they are relative to the player. So essentially you cannot specifically target the closest entity.
@e will now behave similar to @p: selecting the closest entity, or the furthest by setting the "count" parameter to a negative value:
@e does not support closest entity. You can reduce the selection to a radius if you'd prefer:
/kill @e[type=Creeper,r=30]
There is the "count" parameter, but this only selects entities based on when they came into existence, not where they are relative to the player. So essentially you cannot specifically target the closest entity.
well, The "count" parameter could work for what i need
well, The "count" parameter could work for what i need
In that case:
/kill @e[type=Creeper,c=-1]
The above will target the single youngest-existing creeper and kill it.
/kill @e[type=Creeper,c=1]
And this will target the oldest-existing creeper and kill it. You can adjust the numbers to kill a different amount; negative will be for youngest, positive will be for oldest. So if you summon two creepers and use a "count" of -1, the second creeper you summon will be killed.
There is the "count" parameter, but this only selects entities based on when they came into existence, not where they are relative to the player. So essentially you cannot specifically target the closest entity.
@e will now behave similar to @p: selecting the closest entity, or the furthest by setting the "count" parameter to a negative value:
Minecraft-things: http://skylinerw.com
More Minecraft-things: https://sourceblock.net
Guides for command-related features (eventually moving to Source Block): https://github.com/skylinerw/guides
I primarily hang out in the /r/MinecraftCommands discord, where there's a lot of people that help with commands: https://discord.gg/QAFXFtZ
Their corresponding subreddit: https://www.reddit.com/r/MinecraftCommands/
well, The "count" parameter could work for what i need
In that case:
The above will target the single youngest-existing creeper and kill it.
And this will target the oldest-existing creeper and kill it. You can adjust the numbers to kill a different amount; negative will be for youngest, positive will be for oldest. So if you summon two creepers and use a "count" of -1, the second creeper you summon will be killed.
Minecraft-things: http://skylinerw.com
More Minecraft-things: https://sourceblock.net
Guides for command-related features (eventually moving to Source Block): https://github.com/skylinerw/guides
I primarily hang out in the /r/MinecraftCommands discord, where there's a lot of people that help with commands: https://discord.gg/QAFXFtZ
Their corresponding subreddit: https://www.reddit.com/r/MinecraftCommands/
The most advanced advanced adventure map ever created!
well there is the /execute command
it was added in 14w07a on February 14, 2014, a week after your post