How do I hide the name text on a mob?

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.


Solution 1:

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}}

Solution 2:

1.13+ Update

Above answer still applies, however command syntax and format were changed in 1.13+.

1.13 command:

/summon minecraft:villager ~ ~ ~ {CustomName:'{"text":"Bob"}',Passengers:[{id:"minecraft:armor_stand",Invisible:1b,Marker:1b}]}