Help with skull meta not working?

Discussion in 'Plugin Development' started by 5scb8, Dec 22, 2015.

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

    5scb8

    I been trying to figure this out but i'm starting to give up. I can never get the skull to spawn with a custom player head on it it never ever works it just puts a regular skull on it or dose not work.
    Code:
       @EventHandler
        public void onDeath(PlayerDeathEvent e) {
            Location loc = e.getEntity().getLocation();
               Zombie z = e.getEntity().getPlayer().getWorld().spawn(loc, Zombie.class);
               z.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE, 1));
               ItemStack Head = new ItemStack(Material.SKULL, (byte)3);
               SkullMeta meta = (SkullMeta) Head.getItemMeta();
               meta.setOwner(e.getEntity().getPlayer().getName());
              Head.setItemMeta(meta);
                z.getEquipment().setHelmet(Head);
               z.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS, 1));
               z.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS, 1));
               z.getEquipment().setItemInHand(new ItemStack(Material.AIR, 1));
               z.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 20000, 2));
               z.setBaby(false);
               z.setCanPickupItems(false);
     
  2. Offline

    au2001

    ItemStack Head = new ItemStack(Material.SKULL, (byte)3);

    This means 3 skeleton heads, try :

    ItemStack Head = new ItemStack(Material.SKULL_ITEM, 1, (byte)3);
     
    Last edited: Dec 28, 2015
    Zombie_Striker likes this.
  3. Offline

    5scb8

    Nope still dose not work.
    Code:
        @EventHandler
        public void onDeath(PlayerDeathEvent e) {
            Location loc = e.getEntity().getLocation();
               Zombie z = e.getEntity().getPlayer().getWorld().spawn(loc, Zombie.class);
               z.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE, 1));
               ItemStack Head = new ItemStack(Material.SKULL, 1, (byte)3);
               SkullMeta meta = (SkullMeta) Head.getItemMeta();
               meta.setOwner(e.getEntity().getPlayer().getName());
              Head.setItemMeta(meta);
                z.getEquipment().setHelmet(Head);
               z.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS, 1));
               z.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS, 1));
               z.getEquipment().setItemInHand(new ItemStack(Material.AIR, 1));
               z.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 20000, 2));
               z.setBaby(false);
               z.setCanPickupItems(false);
                  
            }
        }
    
    bump

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Dec 23, 2015
  4. Offline

    87pen

    Isn't there a SKULL_ITEM, use that one instead.
     
  5. Offline

    5scb8

    well it sorta work it just set the skull to a steve head it still isnt setting the owner as the player ;(
     
  6. Offline

    teej107

    @5scb8 I heard that you have to place the block down in order for the skin to show up.
     
  7. Offline

    5scb8

    so basically its impossible to do it?
     
  8. Offline

    87pen

Thread Status:
Not open for further replies.

Share This Page