So I have tried for a while now to set a custom name for an entity using snapshot 18w02a, but it won't allow it to spawn. the command is:
/summon villager ~ ~1 ~-3 {NoAI:1b,Invulnerable:1b,Silent:1b,CustomName:"test",CustomNameVisible:1b,Team:"plr1",Proffesion:0,Career:1,Offers:{Recipes:[]}}
When trying to use that all I get is a message that says Unable to summon entity. Does anyone know if maybe it is a formatting change that occurred or if the way you do custom names is different. I looked into the NBT after having tried for a while and found that the tag was still labeled CustomName
. So I'm confused as to what has changed.
2 Answers
In addition to Fabian's answer: The CustomName in 18w02a no longer takes a string as argument, but a json text component. Your tag would look as follows:
CustomName:"{\"text\":\"test\"}"
For all details, I refer you to this minecraft forum post.
-
I tried that, but without the back slashes. I will give that a try. Jan 17, 2018 at 18:47
-
-
-
Works great! and no, you test for it the same way as before.
/execute as @p at @s anchored eyes run teleport @e[type=villager,name=test,team=plr1] ^ ^-1.25 ^1.05
You can also add color to the names with the extra tag\"color\":\"color\"
. So this should make some things much easier to achieve now. The way to do everything feels kinda clunky, but I feel it is an overall great feature. The only way to do color and everything before was via external editing of nbt. Jan 17, 2018 at 19:03 -
But how would you test for an entity that has a translatable text component in its name? Jan 17, 2018 at 19:09
The problem probably isn't CustomName, it looks correct. But you wrote "Profession" with one F too much.
In cases like this, it's always good to write a shorter command first. If the shorter one works, add parts to it one by one, that way you see what part is problematic.
-
the problem is the
CustomName
tag. Without it, everything works just fine. Well, except for profession I guess. Jan 17, 2018 at 18:49