Solved How to setBlock Skull with Skin?

Discussion in 'Spigot Plugin Development' started by KohakuSaintCrown, May 21, 2016.

  1. Hello, i need know how set block but a skull and skin include.

    b.getLocation().getBlock().setType(Material.SKULL); //is not working..
  2. SkullMeta allows you to set the metadata of the block
    • Agree Agree x 1
  3. but that code is not working is not placing a skull in the ground
  4. Code (Text):
    ItemStack skull = new ItemStack(Material.SKULL_ITEM);
            SkullMeta skullMeta = (SkullMeta) skull.getItemMeta();
            skullMeta.setOwner("Players skin");
  5. Choco


    1. b.getLocation().getBlock() - Unless your naming conventions are horrible, why are you getting a block's location then getting the block again? Is b a Block? If it is, just get rid of getLocation().getBlock(). - b.setType(Material.SKULL);
    2. Cast the state to a Skull,
    Code (Java):
    Skull skull = (Skull) b.getState();
  6. Thanks guys is solved, im using this code thanks for you help
    Code (Text):

                                    Block Head = w.getBlockAt(X, Y, Z);
                                    Head.setData((byte) 0x1);
                                    BlockState state = Head.getState();
                                    if (state instanceof Skull) {
                                        Skull skull = (Skull) state;
    • Like Like x 1
    • Useful Useful x 1