Entity Displayname visibility

Dear all,

I am trying to change the kind of visibility of the display name attribute of an entity.

For example I set an entity displayname to Lvl. 1 Test with the following code.

Text displayName = Text.builder("Lvl. 1").color(TextColors.LIGHT_PURPLE).append(Text.of("Test", TextColors.RED)).build();
living.offer(Keys.DISPLAY_NAME, displayName);

Now when I aim the entity I see the display name, but when its not aimed the display name is hidden. Is there any way to show the display name permanently when the player is nearby the entity?

With aim:

Without aim:

I would appreciate any help


I believe you need to set the custom name to be visible.

1 Like

Thats it! Thanks a lot!

One more question: Is there a way to setup the range of the visibility or is it always visible?


I believe the visibility of the name is client side. So the only thing you can control is to enable/disable it based distance between two points. Not sure if thats what you want?

Thanks for the answer.I thought it would maybe possiable to reduce the range between player and entity that triggers the visiblity. I will check if I can control/change that behavior inside my minecraft forge mod.

Thanks for the fast help!

Like I said, you can disable the name if a player is too close using distance checking, however it will effect all players. So yeah, try forge mod on the client side.