Add new items (Like chestpack)?

Discussion in 'Plugin Development' started by xxNightlordx, Oct 13, 2012.

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

    xxNightlordx

    I want to add a new item, but keep the image. Something sort of like this. It doesn't require a server mod or spout but that plugin created a "new" item because, I'm guessing that it doesn't change image.
     
  2. Offline

    stantheman68

    I believe you mean new recipes, and here is a nice and easy tutorial on how to do it :)
     
    Infamous Jeezy likes this.
  3. Offline

    WaffleWolverine

    bcbroz is how i learned how to code. :D hes awesome
     
    CookCreeperz likes this.
  4. Offline

    stantheman68

    Agreed.
     
  5. Offline

    xxNightlordx

    i dont mean like this, this creates new ingredients, not items like the chest pack

    and i saw this vid b4 lol

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
  6. Offline

    stantheman68

    I know what you mean, I would use this technique where after you have made the recipe, you can make that item do something by creating the code below it. If you do not want to do that, I would search for the Chest Pack's source code and edit it from there.
     
  7. Offline

    CevinWa

    Same here
     
  8. Offline

    xxNightlordx

    I already looked through the source code, but the problem is that there's so much code that I don't need, it's hard to filter....

    and i think the source code is missing an extra class.....

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
  9. Offline

    SirTyler

    Since no one bothered to answer his question, I will try to. My best guess is he extends the base Item class and overwrites parts of it with his own code, creating a "new" item that functions differently, after that is just a matter of giving the player a copy of this new item.

    (little side note, this will be more difficult then your average plugin, if you are new to Java and the Bukkit API, I recommend starting with something else)
     
  10. Offline

    TwistedMexi

    I haven't toyed with it yet but if I were to guess, I'd say theres some datavalue you can set that won't affect the block behavior/texture but will allow you to identify it as a different item from the originals.

    Also there is http://jd.bukkit.org/doxygen/de/dd5...Entity.html#a4c23d9eeb686e0ea0a5969a3cc289a3e

    UniqueID but I don't see one corresponding to the ItemStack, so you'd have to do a tiny bit of trickery for inventory add/remove of the special item.
     
  11. Offline

    SirTyler

    You can use Metadata to accomplish what you are looking for (though not as easy as UniqueID's but that is Entity only), I would have to look more into it but I believe you may not even need to use such a thing as bukkit may store a reference to what the actual Item class is that is being used (ie. NewStick versus Stick). If it does not then you would need to use Metadata or durability values as a way to track it.
     
  12. Offline

    mstiles92

    Chestpack actually does not create a new item at all. The chests are still just chests. All it does is track the id, size, etc of the pack with different enchantments, added when the pack gets crafted. (The clients do not show these enchantments, because it is obviously impossible to normally get an enchantment on chests.) Then there are just event listeners that handle the behavior of the pack, making it auto-equip, opening an inventory, etc.

    If you could give more details on what you are trying to do with the new items, I would probably be able to help more.
     
  13. Offline

    xxNightlordx

    What do you mean track the Id, Size, etc :confused:
     
Thread Status:
Not open for further replies.

Share This Page