Hello, i need know how set block but a skull and skin include. b.getLocation().getBlock().setType(Material.SKULL); //is not working..
Code (Text): ItemStack skull = new ItemStack(Material.SKULL_ITEM); SkullMeta skullMeta = (SkullMeta) skull.getItemMeta(); skullMeta.setOwner("Players skin"); skull.setItemMeta(skullMeta);
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(); skull.setOwner("2008Choco");
Thanks guys is solved, im using this code thanks for you help Code (Text): Block Head = w.getBlockAt(X, Y, Z); Head.setType(Material.SKULL); Head.setData((byte) 0x1); BlockState state = Head.getState(); if (state instanceof Skull) { Skull skull = (Skull) state; skull.setRotation(BlockFace.NORTH); skull.setSkullType(SkullType.PLAYER); skull.setOwner(p.getName); skull.update(); }