I am a very nooby coder and am very new to plugin coding itself so forgive me if this sounds like the easiest thing to do ever. so basically i need to find out how to change the skull type of a skull. I have tried many different ways including skull.SetSkullType(SkullType.CREEPER); but keep getting an error under SetSkullType i was wondering if anybody could give me the code to change the skull type.
You can use SkullType enum or you can use its value directly, value for creeper is 4, player 3, zombie 2, wither 1 and skeleton 0. The method is diferent depending on what you're using it on... For Block objects: Code: block.setData((byte)4); // or SkullType.CREEPER.ordinal() instead of 4 Or for ItemStack objects: Code: item.setDurability((short)4); // or SkullType.CREEPER.ordinal() instead of 4
Thank you so much been bugging me for a while and now i can finally get to releasing the plugin one more thing is there a way i can get a different mob like a blaze or an endermans head? EDIT by Moderator: merged posts, please use the edit button instead of double posting.
No, only predefined ones in the game. But you could put a player head with an owner that has a enderman skin. You set the owner using ItemMeta class.... getItemMeta(), store it, check if it's instanceof SkullMeta, cast it, change owner, set it back to the item meta and set item's item meta back to the meta you've edited.
I'm using this but it only changes the direction my skulls are looking to. Can you please help me? Code: Location location = new Location(getServer().getWorld("world"), x, y, z); location.getBlock().setTypeIdAndData(Material.SKULL.getId(), (byte) 2, true); Block block = location.getBlock(); block.setData((byte) SkullType.CREEPER.ordinal());
I believe Mojang actually added mob accounts so you don't have to worry about people changing their skin. Spoiler (Move your mouse to the spoiler area to reveal the content) Show Spoiler Hide Spoiler Mobs: MHF_Blaze MHF_CaveSpider MHF_Chicken MHF_Cow MHF_Enderman MHF_Ghast MHF_Golem MHF_Herobrine MHF_LavaSlime MHF_MushroomCow MHF_Ocelot MHF_Pig MHF_PigZombie MHF_Sheep MHF_Slime MHF_Spider MHF_Squid MHF_Villager Blocks: MHF_Cactus MHF_Cake MHF_Chest MHF_Melon MHF_OakLog MHF_Pumpkin MHF_TNT MHF_TNT2 Bonus: MHF_ArrowUp MHF_ArrowDown MHF_ArrowLeft MHF_ArrowRight MHF_Exclamation MHF_Question
To change the look of skull you have to set owner. I know how to do it as a itemstack not a block tho.
um im doing custom recipes and I need it to craft a wither skull here is the code can anyone tell me how to make it a wither skull? package me.recipe.recipe; import java.util.Arrays; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ShapedRecipe; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.plugin.java.JavaPlugin; public class Main extends JavaPlugin { public void onEnable() { hrecipe(); } private void hrecipe() { ItemStack witherskull = new ItemStack(Material.SKULL_ITEM , 1); ItemMeta meta = witherskull.getItemMeta(); meta.setDisplayName(ChatColor.RED + "wither skull"); meta.setLore(Arrays.asList("Magic")); witherskull.setItemMeta(meta); ShapedRecipe hrecipe = new ShapedRecipe(witherskull); hrecipe.shape( "@@@", "@$@", "@@@"); hrecipe.setIngredient('@', Material.SOUL_SAND); hrecipe.setIngredient('$', Material.BONE); Bukkit.getServer().addRecipe(hrecipe); } } can someone help me with this?