Hello all I am trying to spawn in an armor stand using packets however I cannot get an item to display in the armor stand's hand. I have tried making it visible to no avail. Code (Text): private void spawnArmorStand(Player player, Material itemMaterial) { CraftWorld worldRaw = (CraftWorld)player.getWorld(); EntityArmorStand stand = new EntityArmorStand(worldRaw.getHandle(), player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ()); Material headBlock = itemMaterial; ItemStack headStack = CraftItemStack.asNMSCopy(new org.bukkit.inventory.ItemStack(headBlock)); stand.setInvisible(true); stand.setEquipment(EnumItemSlot.MAINHAND, headStack); PacketPlayOutSpawnEntityLiving spawnPacket = new PacketPlayOutSpawnEntityLiving(stand); sendPacket(spawnPacket, player); }
Every second post here about armor stands using packets will tell you that you will also have to send out the MetadataPacket
your own nms entities must be registerd to bukkit do you mean `stand.setInvisible(true);`?! `setInvisible(bool)` makes an entity "INVISIBLE"! to the given bool. Every entity has this value to false as default.
I managed to fix this with the following code: Code (Text): PacketPlayOutEntityEquipment equipment = new PacketPlayOutEntityEquipment(stand.getId(), EnumItemSlot.MAINHAND, headStack);