Item Balloons

Discussion in 'Plugin Development' started by FloopThatGuy5, May 24, 2015.

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

    FloopThatGuy5

    Code:
    final Item haloItem = p.getWorld().dropItemNaturally(p.getEyeLocation(), new ItemStack(Material.TNT));
                    haloItem.setPickupDelay(Integer.MAX_VALUE);
                        Slime s = (Slime) p.getWorld().spawnEntity(p.getEyeLocation(), EntityType.SLIME);
                        Slime s2 = (Slime) p.getWorld().spawnEntity(p.getEyeLocation(), EntityType.SLIME);
                        s.setSize(1);
                        s.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1), true);
                        s2.setSize(1);
                        s2.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1), true);
                        p.setPassenger(s);
                        s.setPassenger(s2);
                        s2.setPassenger(haloItem);
                        s2.setLeashHolder(p);
    
    Using the code above, does anyone know how I would go about making a skull and setting that's head ("playername") ? I tried itemStacks but it breaks the code. Thanks! :)
     
  2. Offline

    567legodude

    @FloopThatGuy5 To make a skull with a player's head, Create an itemstack with durability of 3. Cast the item meta to SkullMeta, set the owner of the skull, and put the meta on the item.
    Code:
    ItemStack head = new ItemStack(Material.SKULL_ITEM, 1);
    head.setDurability((short) 3);
    SkullMeta meta = (SkullMeta) head.getItemMeta();
    meta.setOwner("playername");
    head.setItemMeta(meta);
    // now use the head.
     
Thread Status:
Not open for further replies.

Share This Page