2
Custom Named Items Doing Different Things?
So, I know that you can make command like "execute at @e[type=snowball] unless block ~ ~-1 ~ air run summon minecraft:area_effect_cloud ~ ~ ~ {Passengers:[{id:bee},{id:bee},{id:bee},{id:bee},{id:bee},{id:bee},{id:bee},{id:bee}]}", but is there a way to make it so that the snowball has to have a certain name to be able to summon them? Like, make it named "SwarmBall" and only then it will summon them? Or if I changed it so summoning zombies, "ZomBall?
3
NBT is indeed the answer, another solution than those below mine would be to rely on tags.
not 100% sure about the syntax since component change but yes like this:
execute at @e[type=snowball,nbt:{components:{"minecraft:custom_name":'{"text":"BeeBall"}'}}] unless ....
you can get the exact syntax by naming a snowball, dropping it, and running data get entity @e[type=item,sort=nearest,limit=1]
that gives you the nbt that item has. you want the custom_name, so just copy that part and use it in the execute (make sure you dont ignore the things that lead to it (like components and nbt))
execute at @e[type=snowball,nbt:{components:{"minecraft:custom_name":'{"text":"BeeBall"}'}}] unless ....
you can get the exact syntax by naming a snowball, dropping it, and running data get entity @e[type=item,sort=nearest,limit=1]
that gives you the nbt that item has. you want the custom_name, so just copy that part and use it in the execute (make sure you dont ignore the things that lead to it (like components and nbt))
I don't think that anything other than items have components. I would personally do a carrot on a stick (reskinned & custom tag), and have a scoreboard check if they used it.
EDIT: snowballs have an item tag. apparently this can change the texture and store components. yay. just created a dirt snowball
Just do /give @s snowball[minecraft:custom_data={zombie_ball:1b}]
and run this repeat/always active
/execute as @e[type=snowball, nbt={Item:{components:{"minecraft:custom_data":{zombie_ball:1b}}}}] run execute at @s run execute unless block ~ ~-1 ~ air run summon zombie
/execute as @e[type=snowball, nbt={Item:{components:{"minecraft:custom_data":{zombie_ball:1b}}}}] run execute at @s run execute unless block ~ ~-1 ~ air run kill @s
Hope this helps!
EDIT: snowballs have an item tag. apparently this can change the texture and store components. yay. just created a dirt snowball
Just do /give @s snowball[minecraft:custom_data={zombie_ball:1b}]
and run this repeat/always active
/execute as @e[type=snowball, nbt={Item:{components:{"minecraft:custom_data":{zombie_ball:1b}}}}] run execute at @s run execute unless block ~ ~-1 ~ air run summon zombie
/execute as @e[type=snowball, nbt={Item:{components:{"minecraft:custom_data":{zombie_ball:1b}}}}] run execute at @s run execute unless block ~ ~-1 ~ air run kill @s
Hope this helps!
