1.17.x setCustomNameVisible is not working.

Discussion in 'Spigot Plugin Development' started by Ninjay_, Jul 6, 2021.

  1. Hi everyone, I'm spawning an entity with a custom name, and I want that name not to appear, so I used setCustomNameVisible(false); but it just doesn't work, what am I doing wrong?

    Code (Text):

    Axolotl axo = p.getWorld().spawn(p.getLocation(), Axolotl.class);
    axo.setCustomName("test");
    axo.setCustomNameVisible(false);
     
    upload_2021-7-6_13-54-50.png
     
  2. setCustomNameVisible(false) makes it so that you only see the name when looking at the mob.
     
  3. I figured that was it, but how do I never show up then? not even when to look.
     
  4. What are you trying to achieve with your custom name?
     
  5. I need to make custom axolotl, and I'm detecting which one is from your custom name, now I need to make that name disappear.
     
  6. Once you find the axolotl with the custom name could you just reset the name back to nothing?
     
  7. No, because the name is like a 'key', to detect what it is, for example, Gold Axolotl
     
  8. Use PersistentDataContainer instead. If you use custom name it’ll always be visible
     
  9. But in this specific code I need to use custom name, because I'm going to use a texture to change the mob color by its custom name.
     
  10. Then the name will be visible