Add Potions to an ItemStack?

Discussion in 'Plugin Development' started by Eistee², Oct 19, 2012.

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

    Eistee²

    Hello,
    I want to add a Potion with his ID to a ItemStack is this possible ? :)
    (the Id´s I have find look like this "373:8196" )

    Sorry for my bad english , I hope someone can help me :)

    No one who can help me :/?

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

    TwistedMexi

  3. Offline

    Eistee²

  4. Offline

    TwistedMexi

    Look up the addData method, it'll explain how to implement the data values.
     
  5. Offline

    Eistee²

    Code:
    DV = potion_name + extended_bit + splash_bit
     
    or
     
    DV = potion_effect + tier_bit + extended_bit + splash_bit
    
    Sorry I really dont know :/
    I think Implement is not my problem when I get the right ID :/
     
  6. Offline

    TwistedMexi

    This has a very in depth table of the values to use:
    http://forums.bukkit.org/threads/info-on-potions.47846/

    The numbers corresponding to the items are what you need to put in addData.
     
    Eistee² likes this.
  7. Offline

    Eistee²

  8. Offline

    ZeusAllMighty11

    Isn't it like:

    ItemStack testpotion = new ItemStack(((Material.POTION), 1), 5);
     
    Eistee² likes this.
  9. Offline

    TwistedMexi

    If you're crafting a new potion yes, but adding to it you would use .setData(datavalue)

    [sorry, I thought it was addData, it's definitely setData() btw]
     
    Eistee² likes this.
  10. Offline

    Eistee²

    Thanks at both :)
     
Thread Status:
Not open for further replies.

Share This Page