help with setting a head on an armor stand

Discussion in 'Plugin Development' started by 360_, Jan 10, 2018.

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

    360_

    So I'm trying to set a head on an armor stand but this keeps happening.
    Here is a picture of the issue.
    https://imgur.com/fTiB0BG

    also you can see that the head that was on the armor stand has the name "Amids's Head"
    https://imgur.com/Tq0pBOS
    Code (open)

    Code:
    @EventHandler
        public void onPlayerInteract7(PlayerInteractEvent e) {
            Player p = e.getPlayer();
            if ((e.getAction() == Action.RIGHT_CLICK_AIR) && (p.getItemInHand().getType() == Material.BLAZE_ROD)) {
                ArmorStand armorStand = (ArmorStand) p.getWorld().spawnEntity(p.getLocation().add(0, -1.45, 0), EntityType.ARMOR_STAND);
                    ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
                    SkullMeta skullMeta = (SkullMeta) skull.getItemMeta();
                    skullMeta.setOwner("Amids");
                    skull.setItemMeta(skullMeta);
                    armorStand.setHelmet(skull);
                    armorStand.setCustomName("Egg (Events)");
                    armorStand.setCustomNameVisible(true);
                    armorStand.setGravity(false);
                    p.sendMessage("§aEvent egg spawned!");
            }
        }
     
  2. Offline

    Zombie_Striker

    @360_
    I don't see what the problem is. The head textures are the same, it has the same name.

    BTW: Its concerning you have a 7 in the method name. You should only have one instance of an event for a plugin.
     
  3. Offline

    360_

    @Zombie_Striker
    Yeah, I'm getting each method on its own plugin, and the skin And the head doesn't change the player skin, that's what I I'm trying to fix
     
  4. Offline

    Zombie_Striker

    @360_
    This is a known bug: The head needs to exist somewhere in the world before textures are applied. The easiest way of doing this is changing the block at the bottom of the world to be the head, waiting a second, then change the head back to the original block and then spawning the armorstand with the head.
     
Thread Status:
Not open for further replies.

Share This Page