Solved Creating holograms without dependecies

Discussion in 'Spigot Plugin Development' started by mlgcraftnetwork, May 25, 2016.

  1. So I want to create holograms but I don't want to use any other plugins to do this, I have tried to find a way to do this for ages but I didn't get anywhere. I did find out you can use horses and make them invisible to create a holograms but I have no idea how to do that. Does anyone know how to make this? Thanks.
     
  2. Create an invisible armour stand using armorStandVariableName.setVisible(false); and set the gravity to false too using armorStandVariableName.setGravity(false); then give it a name by using armorStandVariableName.setCustomName(String hologramText);

    Oh, and by the way, you need to use armorStandVariableName.setCustomNameVisible(true); so it always shows
     
    • Agree Agree x 4
    • Winner Winner x 1
  3. MiniDigger

    Supporter

    we used the hacky horse method back when there were no armorstands.
    Nowadays it is as easy ais Phineas explaind.
     
    • Informative Informative x 1
  4. I suggest also setting it to marker, makes players unable to interact with it, and, in 1.9, it moves the display name location to its actual location, the base plate area.
     
    • Like Like x 1
    • Useful Useful x 1
  5. Thanks, I will try to do it using an armorstand.
     
  6. I got it to work FIRST TIME! I'm so happy right now! THANK YOU ALL!
     
  7. One question, how do I remove them again xD? I spawned a test hologram not expecting it to work (Like always -_-) but now I need to remove it.

    UPDATE:
    I killed it using /kill @e[type=ArmorStand,r=3] but how do I remove them using code?
     
  8. MiniDigger

    Supporter

    Entity#remove() kills the armorstand ^^
     
    • Agree Agree x 3
  9. Would thise kill all entities or do I need to do
    Code (Text):
    stand.remove();
    ?
     
  10. MiniDigger

    Supporter

    you need to remove every single armorstand you created
     
    • Like Like x 1
  11. This is my code:
    Code (Text):
        public void spawnHolo(Location loc) {
            ArmorStand stand = loc.getWorld().spawn(loc, ArmorStand.class);
            stand.setBasePlate(false);      
            stand.setCustomName("§6Test");
            stand.setCustomNameVisible(true);
            stand.setGravity(false);
            stand.setVisible(false);
            stand.setMarker(false);
            }
    So should I be able to do
    Code (Text):
    stand.remove();
    ?
     
  12. MiniDigger

    Supporter

    you should make a list with all your spawned armorstands so that you can remove them later with the remove method
     
    • Agree Agree x 1
  13. Note that when chunks unload your original entity won't be present. Generally what I do is just remove and then respawn any hologram armor stands when chunks unload and load, keeps things simple.
     
  14. So
    How would I do this? Because the hologram even stayed after restarting.
     
  15. MiniDigger

    Supporter

    just reread that post of mine you quoted...
     
  16. I agree with MiniDigger and really simple.