Minecraft – How to hide the name text on a mob

minecraft-commandsminecraft-java-edition

I want to summon custom Villagers for my minecraft adventure map that I am making.
I figured out that to hide their career from their trading interface that you have to give them a custom name, but I only want the custom name to show in the trading interface and not when you hover over them. (Previous Question)

However when I do:

/summon Villager ~ ~ ~ {CustomName:Bob,CustomNameVisible:0}

Their Custom Name still shows. I don't know if this is a result of the way the CustomName tag works for mobs, or not. If anyone could explain this that would help a lot.

Best Answer

An entity will not display its CustomName if there is another entity on top of it. For example, you can summon the villager with an invisible ArmmorStand on top of it:

In version 1.9 or higher:

/summon Villager ~ ~ ~ {CustomName:Bob,Passengers:[{id:ArmorStand,Invisible:1b,Marker:1b}]}

In versions 1.8 or lower:

/summon ArmorStand ~ ~ ~ {Invisible:1b,Marker:1b,Riding:{id:Villager,CustomName:Bob}}