#Get type of entity

1 messages · Page 1 of 1 (latest)

livid kite
#

Is it possible to get the type of an entity (ie "minecraft:pig") as NBT? I thought entities had an id NBT, but it turns out they don't

zealous relicBOT
#

<@&1201956957406109788>

Someone will come and help soon!

💬 While you wait, take this time to provide more context and details.

🙇 If nobody has answered you by <t:1724077282:t>, feel free to use the Summon Helpers button to ping our helper team.

✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve

little echo
#

I think you have to hardcode them

livid kite
#

dangit

little echo
#

You can use a binary search to make it more efficient

livid kite
#

how?

#

the list of entities isn't sorted in any way

little echo
#

You would need to use tags

livid kite
#

wdym

frigid dock
#

if you want entities to have an nbt id, just use /data to give them a custom id in the nbt
or just summon them with said data

frigid dock
#

they cant?

#

dangit

livid kite
#

nah, only markers

frigid dock
#

tags then

livid kite
#

I still then have to hardcode for each tag

silk parcelBOT
#

I'll just hardcode a file like:```ansi
execute if entity @s[type=minecraft:allay] run return run data modify storage genome:temp entity set value "allay"
execute if entity @s[type=minecraft:armadillo] run return run data modify storage genome:temp entity set value "armadillo"
...

frigid dock
#

uhhh

#

are those files just like commands in a command block?

livid kite
#

Yeah

frigid dock
#

huh

worn flame
#

I'm glad to say that I've had this problem before and I have found a solution!

livid kite
frigid dock
#

ok

worn flame
#

You can use the ride command to make the entity a passenger and get the id via the Passengers nbt

livid kite
#

ooh

livid kite
worn flame
#

Well, it's only one summon, one ride, one data get & one kill (that is if you don't keep the "vehicle" entity for other times you need to get an entity's id) instead 50+ execute if entity @s

It's at least way more substainable & readable I think

stray peak
livid kite
#

okie thank you everyone