2

Custom Named Items Doing Different Things?

User5167897G 6/3/24 12:10 pm
442
6/6/2024 8:14 pm
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?
Posted by
User5167897G
Level 1 : New Miner
0

  Have something to say?

JoinSign in

3

ShelLuser
06/06/2024 8:14 pm
Level 61 : High Grandmaster System
NBT is indeed the answer, another solution than those below mine would be to rely on tags.
1
imalittlhigh
06/04/2024 6:53 am
Level 67 : High Grandmaster Sweetheart Stack
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))
1
MonkeManII
06/04/2024 7:43 am
He/Him • Level 36 : Artisan Procrastinator Nerd
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!
1

Welcome