Solved Armorstands with packets

Discussion in 'Plugin Development' started by BimKurzAfk, Aug 27, 2020.

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

    BimKurzAfk

    I want an "fake" armorstand with no hitbox, I got so far this:
    Code:
    WorldServer s = ((CraftWorld)p.getWorld()).getHandle();
            EntityArmorStand stand = new EntityArmorStand(s);
          
            stand.setLocation(loc.getX(), loc.getY(), loc.getZ(), 0, 0);
            stand.setCustomName("I'm a Armorstand!");
            stand.setCustomNameVisible(true);
            stand.setInvisible(false);
            PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(stand);
         
            ((CraftPlayer)all).getHandle().playerConnection.sendPacket(packet);
            
    The problem is that the player I send these packets can't hit through the armorstand, is there a way to avoid this?
     
  2. Offline

    Kars

    No. The client thinks there is an armorstand in the way so it interacts with the armorstand. There is nothing you can do about that.

    Perhaps this will allow you to find a workaround, though:
    https://www.codota.com/code/java/methods/org.bukkit.entity.Player/getTargetBlock
     
  3. Offline

    KarimAKL

    @BimKurzAfk Set the armorstand as a marker, that basically removes the hitbox.
     
Thread Status:
Not open for further replies.

Share This Page