Hello, I've searched for a while now, but haven't found any good tutorial/example on how to create custom Items with Bukkit. There are a few things I need to know: First: Is it possible to create custom Items. And with custom Items I really mean stuff like my own armor, my own weapons, my own food? Is it possible to use my own material for it? If not why? Even if I can't use my own material (at this point I'd just use any given material from Minecraft) how would I create this custon Item? Would I need to create a given Item (maybe a Leather Armor) and manipulate it to what I need, or can I program the Item "from scratch"? Thank you
Lokikol To answer your questions: Yes, it is possible to create 'custom items' (in a sense, read on...). You cannot use your own material as it is bound by the limits of Minecraft (e.g. if the material does not already exist, then you cannot use it; however resourcepacks aren't holding anyone back). The methods to create a custom item is either: [1] Crafting it in a crafting table (by adding a recipe) [2] Having it given to a player (e.g. give command etc.) Allowing the specific item to have a different effect (e.g. a sword which does more damage, armor which heals yourself every time you get hit, a feather that lets you fly) can be done by using a Listener. Recipe example: Code:java ItemStack item = new ItemStack(Material.WATCH, 1); item.addUnsafeEnchantment(Enchantment.SILK_TOUCH, 2); ItemMeta im = item.getItemMeta(); im.setDisplayName("Time Transfer Device"); String itemlore[] = { (new StringBuilder()).append(ConfigHandler.getConfig().getString("clockLore")).toString() }; im.setLore(Arrays.asList(itemlore)); item.setItemMeta(im); ShapedRecipe recipeitem = new ShapedRecipe(item); recipeitem.shape(new String[] { " G ", "GRG", " G " }); recipeitem.setIngredient('G', Material.GOLD_INGOT); recipeitem.setIngredient('R', Material.REDSTONE_BLOCK); getServer().addRecipe(recipeitem); You create the itemStack normally and you are free to add whatever lore/displayname/enchantments as you wish. You then create a recipe and add it to the server (I don't quite know how to make a shapeless recipe). Alternatively, you could just give the player the itemStack with a command.
Alright, thank you. I'll try that So for your example, if I want to add special behaviour, I'd add a listener which asks for the Event I want to listen, and then checks the Item the Player is holding (if it is type() == Material.WATCH) and also ask if the display Name equals to Time Transfer Device to be sure it's my custom Item. Right?