1.8 setCustomNameVisible

Discussion in 'Spigot Plugin Development' started by MCCoding, May 7, 2015.

  1. As we all probably would know by now that setCustomNameVisible(true) no longer functions as it did in 1.7, I'm trying to figure out if there is any other way around this to make it function like it did. Before you say to spawn armour stands I don't want to be tracking twice the amount of entitys as I really need to be and updating armour stands as well. Is there any packets or a possible way to some how port over the setCustomNameVisible(true) from amour stands to normal living entitys since this aspect is mandatory for my plugin.
     
  2. Inkzzz

    Resource Staff

    You have two options;
    1. Create an armour stand, set the armour stand name, then make the armour stand invisible.
    2. Use packets / holograms.
     
  3. I would much rather use packets but what packets would I have to use?
     
  4. Which version are you going to use 1.7 or 1.8 or both 1.7&1.8?
     
  5. Look at wiki.vg.
     
  6. I'm using 1.8 hence why I'm having this issue

    I've looked all through it and I have no idea on what packet would be required, all I'm thinking is It could be something to do with entity meta data but I'm still unsure.
     
  7. Read Hologram Source Code
     
  8. Ohhhh You do know that 1.8 uses invisible armor stand as nametags that can u can see anywhere u go
     
  9. I know read the OP I say that I'm looking to see if there is an alternative way other than armour stands since I would need to track twice the amount of entities and update armour stands just for a name tag.
     
  10. Unfortunately, you'll have to use some kind of alternate method since you can only see the tags of regular living entities if looking at them directly. I'd recommend using a PacketPlayOutSpawnEntityLiving and send that to the client. Just make sure to make it invisible and disable gravity. If you need to have many named mobs, I'd also recommend creating some sort of combination/all-in-one system that lets you easily create the bundle.
     
  11. As I noticed on hypixel and Mineplex, the invisible hologram entity is actually "riding" the original entity.
     
  12. Like holographic displays with the 1.8 clients on the protocolhack it spawns horses :D
     
  13. Maybe something else, is there a way to quickly figure out how exactly they did that? I can only see stacked invisible entities (using one of my mods :D )
     
  14. See this, what do you guys think? The health bar will always sightly above a LivingEntity's head.
    [​IMG]
     
  15. a little bit buggy =/ but nice
     
  16. I've tried using PacketPlayOutSpawnEntityLiving and it's just crashing my client, but one server I know who is pulling it off to an extent is wynncraft and they have it so the name tags are following on with the entities well as for the PacketPlayOutSpawnEntityLiving packet here is what I had I could be doing it wrong

    Code (Text):
            PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(((CraftLivingEntity) entity).getHandle());

            try {
                Field l = packet.getClass().getDeclaredField("l");
                l.setAccessible(true);
                l.set(packet, getWatcher(getName()));
                l.setAccessible(!l.isAccessible());
            } catch (Exception x) {
                x.printStackTrace();
            }

            for (Player reciever : Bukkit.getOnlinePlayers()) {
                ((CraftPlayer) reciever).getHandle().playerConnection.sendPacket(packet);
            }
     
  17. Holographic Displays also has a developer API, it should help you out for sure.
     
  18. I didn't test it yet, but this tutorial would be crap then...