If you want to teleport any dropped item, then you simply need to select them with @e[type=Item]
. For example:
/tp @e[type=Item] X Y Z
If you want to teleport dropped items of a certain type (e.g: only cobblestone), then it'll take two commands.
There's no selector argument (like type=
) that can directly detect the item name of a dropped item entity, so you'll need to first use a command that can target based on NBT data, such as /scoreboard players tag
:
/scoreboard players tag @e[type=Item] add IsCobblestone {Item:{id:"minecraft:cobblestone"}}
You can then target the item entities based on that scoreboard tag you just added to it:
/tp @e[type=Item,tag=IsCobblestone] X Y Z
Have you tried making it yourself?
What you can try doing is:
- Assign a scoreboard value based on a mob's health.
NB: You cannot use the health
criteria on entities. Only players.
/scoreboard objectives add healthbar dummy
- Test for mob healths and assign them a score based on their current health in a repeater command block.
/scoreboard players set @e healthbar __ {Health:__s}
Replace __
with a health value, and repeat from 1 (half a heart) to 100 (max health of golems).
You should have a long row of command blocks just doing this if you're doing it correctly.
- Give mob names based on their health. Here's two unicode symbols that represent hearts:
♥♡
, every tick after #2 happens.
If you know what you are doing, you can find your heart symbols in here.
/entitydata @e[score_healthbar_min=20,score_healthbar=20] {CustomName:"♥♥♥♥♥♥♥♥♥♥"}
/entitydata @e[score_healthbar_min=18,score_healthbar=19] {CustomName:"♥♥♥♥♥♥♥♥♥♡"}
/entitydata @e[score_healthbar_min=16,score_healthbar=17] {CustomName:"♥♥♥♥♥♥♥♥♡♡"}
/entitydata @e[score_healthbar_min=14,score_healthbar=15] {CustomName:"♥♥♥♥♥♥♥♡♡♡"}
and so on... Of course, you could just do plain numbers:
/entitydata @e[score_healthbar_min=20,score_healthbar=20] {CustomName:"♥ 20"}
/entitydata @e[score_healthbar_min=19,score_healthbar=19] {CustomName:"♥ 19"}
/entitydata @e[score_healthbar_min=18,score_healthbar=18] {CustomName:"♥ 18"}
/entitydata @e[score_healthbar_min=17,score_healthbar=17] {CustomName:"♥ 17"}
or, if you cannot use Unicode:
/entitydata @e[score_healthbar_min=20,score_healthbar=20] {CustomName:"Health: 20"}
/entitydata @e[score_healthbar_min=19,score_healthbar=19] {CustomName:"Health: 19"}
/entitydata @e[score_healthbar_min=18,score_healthbar=18] {CustomName:"Health: 18"}
/entitydata @e[score_healthbar_min=17,score_healthbar=17] {CustomName:"Health: 17"}
If you know what you're doing, you should have a long chain of about about 150 chain command blocks and a repeat command block and mobs should have health bar as their custom name. Less, if you only only want to test a smaller health range, or put all mobs with more than 20 health as "20+
" or any other optimisation changes, etc.
The downsides to this system however, is ALL NAMETAG NAMES WILL BE OVERWRITTEN.
A workaround would be to put @e[type=MOBNAME]
, but that would multiply the number of commands you have to create by the number of mobs you want to track.
Or, you could look at this answer on how to tag specific mob types and then instead of the above paragraph, just edit your health testing commands to only test selected mobs. Of course, you would need a few more extra command blocks to do your marking of mobs that should have their health tracked and displayed and the command blocks handling steps 2 and 3 should have a selector to filter for those mobs too.
Best Answer
To teleport all cobblestone to your player, you need to use teleportation. The Official Minecraft Wiki summarization of this game mechanic is excerpted below:
This is the best solution your question because it is instant, efficient, and simple. Alternatives would include using water streams or slime block contraptions to move the items. These are complicated and take time to set up. But you already specified in your title that you wanted to use teleportation, so you probably knew all of this already.
You can use teleportation via several methods, such as throwing an ender pearl, eating a chorus fruit, or passing through a Nether portal, End portal, Exit portal or End gateway. For this question, we can use teleportation via commands, as long as you have a high enough permission level and also satisfy the restrictions.
There are many commands, but the one we are concerned about is the /teleport command. It has a complicated and thorough syntax. Of the many usages, you can use the
tp
command like so:Here, we must satisfy 2 arguments. The second argument,
<location>
, is easy. It accepts anx
,y
, andz
coordinate as the location. To teleport the items to your player's current location, we can use Relative World Coordinates. This allows you to avoid needing to know the exact coordinates of your player. Here is what it would look like:The first argument,
<targets>
, is a little more complex. Most simply, the target can be a player-name, like so:But to select an item, you need to use a target selector. A target selector consists of 2 main parts: a target selector variable, and an optional target selector argument.
There are 5 target selector variables:
...and many many target selector arguments. Since items are an entity, we will be using the
@e
target selector variable. It's usage would be as follows:Beware, this command can cause disaster! Notice how the target selector variable selects all entities—this includes all mobs, paintings, armor stands, minecarts, players, and items!
To filter out only item entities, we can use the
type
target selector argument. This can be appended to the target selector variable like so:Finally, to filter out only cobblestone items, we can use another target selector argument to detect the item's nbt data: