Floating Display Name (Name Tag)

Discussion in 'Plugin Development' started by WiseHollow, Oct 26, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    WiseHollow

    I'm trying to make a floating name tag type-thing in my plugin. What are some ways to do this? I don't want to use another plugin's API.

    Any help is appreciated!
     
  2. Offline

    acer5999

    I'd recommend checking out HoloAPIs source code for ideas on how it's done, I personally have no idea although I'm assuming it's done using invisible entities with name tags.
     
  3. Offline

    lewysryan

    NMS.

    Look at it will help you with the nms.
    https://github.com/sgtcaze/Tutorial/tree/master/Season 3/EP27


    you need to change this in the example class
    Code:java
    1. b.setCustomName("Hacks");
    2. b.setCustomNameVisible(false);


    set it to true.

    I THINK this will spawn a invisible bat (with no particles) and it doesn't move with just the name.

    Also this will help
    https://forums.bukkit.org/threads/tutorial-register-your-custom-entities-nms-reflection.258542/


    If not I think it's done with age, setting it to a massive - number will break the entity and put it in the void leaving the name tag where it should be
    Good luck!
     
  4. Offline

    WiseHollow

    Code:java
    1. private void spawnEntityToLocation()
    2. {
    3. this.entity = location.getWorld().spawnEntity(location, EntityType.HORSE);
    4. ((Horse)this.entity).setAge(-1700000);
    5. PotionEffect effect1 = new PotionEffect(PotionEffectType.SLOW, Integer.MAX_VALUE, 6);
    6. PotionEffect effect2 = new PotionEffect(PotionEffectType.JUMP, Integer.MAX_VALUE, 128);
    7. ((LivingEntity)this.entity).addPotionEffect(effect1);
    8. ((LivingEntity)this.entity).addPotionEffect(effect2);
    9. ((LivingEntity)this.entity).setCustomName(this.text);
    10. ((LivingEntity)this.entity).setCustomNameVisible(true);
    11. }

    When I use this, the Horse disappears right after i spawns. No idea what happens to it. :(
     
  5. Offline

    WiseHollow

    Bump. Any help?
     
  6. Offline

    WiseHollow

    Anyone??
     
  7. Offline

    Dudemister1999

    WiseHollow You could always use one of the API's that great people have made. Since the original person came up with the idea, I've seen 5+ plugins just for it. If you insist upon NOT using an API, I think setting the age to something below 0 causes problems.
     
  8. Offline

    WiseHollow

    Dudemister1999 Well I am trying to learn at the same time. So using someone's API is like skipping a step in my plugin.

    The last thing I need is for someone to point me in the right direction for making the entity invisible but still show it's display name. Any ideas?
     
  9. Offline

    Dudemister1999

    WiseHollow Using an API isn't "skipping" a step, it's making the process of creating something easier. That's like saying "Google searching isn't useful, I'll just browse every website out there to find a snippet of text."

    As far as your problem, try this:
    *EDIT* Wrong link. Look at how this person did it here:
    https://github.com/filoghost/HolographicDisplays
     
  10. Offline

    jensdeboom

Thread Status:
Not open for further replies.

Share This Page