1.16.5 Can't damage ArmorStand

Discussion in 'Spigot Plugin Development' started by Bosternike, Jun 1, 2021.

Thread Status:
Not open for further replies.
  1. I've created ArmorStand, but I can't damage it.
    How can i fix it?

    My code:
    Code (Text):

    public void spawnStand() {
            this.stand = (ArmorStand) loc.getWorld().spawnEntity(loc.subtract(0, 0.500, 0).add(0.500, 0, 0.500), EntityType.ARMOR_STAND);
            this.stand.setGravity(false);
            this.stand.setCanPickupItems(false);
            if(name != null) {
                this.stand.setCustomName(MobUtils.toColor(name.replace("%health%", Double.toString(health))));  
            }
            this.stand.setCustomNameVisible(true);
            this.stand.setVisible(false);
            this.stand.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(health);
            this.stand.setHealth(health);
            this.stand.getEquipment().setHelmet(new ItemStack(Material.OBSIDIAN));
            this.stand.setInvulnerable(false);
        }
     
     
  2. Hi,
    do you mean how to remove the armorstand?

    If so, you can use this command:

    /minecraft:kill @e[type=ArmorStand,c=1]

    then you remove the nearest armorstand.

    Best regards!
     
    #2 fishgamer, Jun 1, 2021
    Last edited: Jun 1, 2021
  3. Why are you using „this“ all the time?
     
  4. stand.setInvulnerable(false);
     
  5. Did you look at the code OP provided? He already used that method
     
  6. I dont think there is something wrong with that part. Do you use the armorstand in some events? Is it only your Armorstand or every Armorstand on the server?
     
  7. Oh, I know it's not important, but I used for beauty
     
  8. It seems I didn't use any Events which is able to cancel damage.
     
  9. No, I don't need to kill, I need the ArmorStand to be damage able
     
  10. Is it only your armorstand or every armorstand on the server?
    Do you got the problem without your plugin as well?
     
  11. By the way. How do I make the ArmorStand unbodied like a real Hologram?
     
  12. I can break a default minecraft ArmorStand
     
  13. this.stand.setMarker(true);
     
    • Like Like x 1
  14. Oh, It works! Thak you so much!
     
  15. Guys, I've found the reason of ArmorStand not being damage able.

    When I use this method
    Code (Text):
    this.stand.setVisible(false);
    the ArmorStand makes not damage able. Why? I think some Events are to blame. Which events can cancel it?
     
  16. It's a vanilla feature. Armorstands tagged with the invisible tag will not take damage, you can try it yourself on a singleplayer world.
    Code (Text):
    /summon armor_stand ~ ~ ~ {Invisible:1b}
     
    • Like Like x 1
  17. Yes, I've tried. You're right. But is there any methods to make the ArmorStand Invisible and receiving damage?
     
  18. The player would not know what to hit though; Especially when you set the marker, the hitbox of the armor stand becomes almost zero. If you do need to do hit detection, another entity like slime or magma cube might be better because they have square hitboxes
     
    • Like Like x 1
    • Agree Agree x 1
  19. There is a method to make an ArmorStand INVISIBLE and DAMAGEABLE.
    Code (Text):

    this.entity.setInvisible(true);
     
     
  20. By the way guys. How to make ArmorStand RECEIVING Damage but not breaking on multi-click?
     
Thread Status:
Not open for further replies.