Floating tag above block

Discussion in 'Plugin Development' started by MrGeneralQ, Dec 6, 2016.

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

    MrGeneralQ

    Good evening

    I was wondering if anyone could explain me how I would be able to make a nametag float above a block.

    Thanks!
     
  2. Offline

    Zombie_Striker

    @MrGeneralQ
    1. Spawn an entity (does not matter which one. Could be a silverfish or an armorstand) at the block's location.
    2. If the entity makes sound, turn off sounds using "setSilent". If the entity moves, turn off ai using "setAI"
    3. Change the custom name for the entity to be equal to the nametag you want. After that, set the custom name visible to true.
    4. When the block breaks, remember to kill the entity or else the entity /nametag will stay there.
     
  3. Offline

    MrGeneralQ

    And what about the mob? any possible way to make it invisible without using a potion?
     
  4. @MrGeneralQ
    Well yes, but you can make the potion not display particles by setting the "particles" boolean to false when creating the effect. Although I'm unsure if the name tag displays if the entity has the invisibility effect.

    EDIT: I forgot about Armour Stands, they are the ideal thing to do this with, since they have the "setVisible()" method, which lets you make them invisible without a potion effect.
     
    Last edited: Dec 6, 2016
    MrGeneralQ likes this.
Thread Status:
Not open for further replies.

Share This Page