Custom potions recipes

Discussion in 'Plugin Development' started by Panda_Crafter, May 22, 2013.

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

    Panda_Crafter

    Hello,
    I'm wondering of i can maken a plugin with some custom potions recipes?
    Please give me the code!
     
  2. Offline

    caseif

    I'm not going to give you code, because then you'd not learn nearly as much as if you created it yourself. However, what you need to do is create an ItemStack of type potion (what type is up to you), then change the DisplayName through the meta (so it wouldn't be misleading). Then you can just create new PotionEffects and add them to the PotionMeta of the stack.
     
  3. Offline

    Minnymin3

    AngryNerd
    Know of any way to register a new potion recipe?

    And you can detect when a player drinks the potion with PlayerConsumeItemEvent (or something like that)
     
  4. Offline

    caseif

    You would need to register it as a crafting recipe when the plugin is enabled. A quick Google search should reveal how to do that. As for detecting when a player drinks the potion, that's completely unnecessary. If you've bound the PotionEffects to the ItemStack with the PotionMeta, the effects will automatically be applied to the player upon drinking the potion.
     
  5. Offline

    Minnymin3

    I want to actually have the potion be brewable and i have the playerconsumeitem event because I have a custom potion effect that refils the players mana (see my plugin Zephyrus). I already have a custom crafting recipe for it but brewing is much cooler :p.
     
  6. Offline

    caseif

    Ooh, then I've got nothing. I've never added brewing recipes, though I should think there's a method to do so in the Bukkit API. Have you tried Googling it?
     
  7. Offline

    Minnymin3

    Googled it a few times and looked through bukkit source. No official api AFAIK and I haven't gotten around to decompiling the minecraft server (its not available anywhere!!!)
     
  8. Offline

    caseif

    Ehh... Yeah, I'm out of ideas.
     
  9. Offline

    Minnymin3

    Ive got no idea where minecraft even registers the potion crafting recipes...
     
  10. Offline

    Cycryl

    Minnymin3 ShadyPotato Panda_Crafter
    Wow I am more than a year late....
    Still: I thought of a way it could be possible:
    if you cant register a new potion effect you can still check via InventoryClickEvent when the inventory gets clicked.
    then check if the correct items are in there. and have a timer running to count down the brewing process.
    now send the players a PacketPlayOutProgressBar to show them the anination of the brewing stand.
    Once your timer is at zero you edit the inventory of the brewing stand placing potions in the result slots.
    And there you have it: A fake Potion Recepie :D
     
  11. Offline

    Minnymin3

    Cycryl

    Thats a good way to get around it. Potion recipes are client sided as well as server sided so yeah thats about the only way around it (correct me if I'm wrong)
     
    Cycryl likes this.
Thread Status:
Not open for further replies.

Share This Page