Custom Potions

Discussion in 'Plugin Development' started by ZephireNZ, Mar 21, 2013.

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

    ZephireNZ

    Now that we've got a PlayerItemConsume Event, I'm making a plugin that provides temporary flying.

    I'm trying to work out how to give it the *look* of an invisibility potion, but not have it's effect. As far as I understand, that means that PotionType.INVISIBILITY won't work for what I want. How do I go about doing so?

    Also, if it's possible. Is there anyway to give an item a unique way to work out it's a fly potion? I'll be giving it a custom name, but other that I'm not sure how to make sure I know it was this kind of potion that was drunk.

    Any help is appreciated. Thanks!
     
  2. Offline

    kreashenz

    I am not entirely sure this would work without Spout ( if its the same concept as custom achievements ), so I wouldn't try it. I'm actually not sure, so just wait for another reply.
     
  3. Offline

    ZephireNZ

    I'm not meaning I want to have a custom effect, I know that isn't possible as it would mean changing client-side things. What I'm asking for is if you can have a potion that looks like one, but doesn't act like one. (It's a dummy for server-side logic)
     
  4. Offline

    kreashenz

    ZephireNZ Yeah, I'm not entirely sure about that.
     
  5. Offline

    ZephireNZ

    So I've decided to try instead using a custom delay night vision potion. This is the code I have:
    Code:java
    1. PotionEffect NightVision = new PotionEffect(PotionEffectType.NIGHT_VISION, (int) (60 * 20L), 1);
    2. PotionType NightVisionType = new PotionType(6,NightVision.getType(),1);
    3. Potion InvisPotion = new Potion(/*Potion Type Here */);


    Problem is, I'm not sure how to properly do the PotionType bit. Any pointers, or ways to make this a lot simpler?

    Anybody?

    Sorry, bump. I'm desperate...

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

    Rprrr

    There is no such thing as PotionEffectType.FLYING. ;)

    Check if you the potion that was consumed is a 'flying potion' (so it has to have a custom name / lore / whatever to identify it as a flying potion first), if it is, cancel the ConsumeEvent, manually take one potion, then allow the fly mode & start a runnable for removing it later.
     
  7. Offline

    ZephireNZ

    Haha, I know that. I'm using the Player.setAllowFlight and setFlying to do the "potion" part, and I've already got it to go for a specific time, and in all honesty I've now decided to stick with a water bottle, so I don't have to bother with effects. What I'm looking for is a way to identify that potion, that can't be replicated in game (so for example, a custom name won't cut it). Custom durability is out of the question too, it causes it to be an actual potion...
     
  8. Offline

    Scyntrus

    Just take an existing potion that is not craftable and you don't intend to use, and disable its use and replace the effects with your own.
     
  9. Offline

    chasechocolate

    Or use PotionMeta.
     
Thread Status:
Not open for further replies.

Share This Page