Solved ArmorStands getting in the way of hitting mobs

Discussion in 'Plugin Development' started by FoxinatorDev, Nov 27, 2019.

  1. Offline

    FoxinatorDev

    I'm not sure how to explain this but I'm trying to make a damage indicator where when a player hits an entity, it spawns in a hologram saying how much damage they dealt and then deletes itself a second after, but the problem is that the Armor stand is getting in the way of the player hitting other mobs. I want to make it so you can't hit the armor stand but able to hit whatever you're trying to hit, like pretending the armor stand isn't there. I'm sorry if this doesn't make sense, I don't know how else to explain it.
     
  2. Offline

    yPedx

    @FoxinatorDev
    No idea if this would work, but I read somewhere that you could cancel PlayerInteractEntity event (if it's an armourstand) and that'll apparently work. I've not tested though, and the thread was old so things might have changed, or never worked in the first place.
     
  3. Offline

    FoxinatorDev

    How would I check if the player is hitting an armor stand though if I'm using player interact event
     
  4. Offline

    yPedx

    @FoxinatorDev
    What about EntityDamageByEntityEvent? Cancel if entity is an instance of Armorstand?
     
  5. Offline

    FoxinatorDev

    I've tried that but the armor stand still blocks the hits
     
  6. Online

    KarimAKL

    @FoxinatorDev Use ArmorStand#setMarker(true), that'll remove it's collision box.
    Or well, at least it'll make it very small. (I've never hit an armorstand with a marker so, that's why i said "remove")
     
  7. Offline

    FoxinatorDev

    It works, thank you!
     
    KarimAKL likes this.

Share This Page