Solved Remove the potion effect from its display?

Discussion in 'Plugin Development' started by r0llingthund3r, Jul 28, 2014.

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

    r0llingthund3r

    I was wondering how I would go about removing the potion effects from it's display? I need a red potion with custom effects. That requires me to use an instant health potion, but I don't want it to say Instant Health.
     
  2. Offline

    _LB

    If you add custom effects, the damage value is ignored - just make it an instant health potion and then add your custom effects - they will override the instant health. This is a vanilla feature.
     
  3. Offline

    r0llingthund3r

    @_LB So there is no way to remove it entirely?
     
  4. Offline

    _LB

    Adding custom effects does remove it entirely.
     
  5. Offline

    ampayne2

    The OP asked how to make the actual ItemStack not show "Instant Health"
     
  6. Offline

    _LB

    ampayne2
    I believe I gave the answer that satisfied his needs.
     
  7. Offline

    ampayne2

    If you think modifying the actual effects of a potion and modifying the text on its ItemStack are the same then you need to reevaluate your beliefs :)
     
  8. Offline

    _LB

    Instead of telling me I am wrong, how about you actually try it out yourself? In fact I actually happen to have a plugin already written for you that does just that:
    https://github.com/LB--/TestPlugin/tree/BUKKIT-3635
    When you log in it gives you what looks like slowness potion, but it only has the speed 2 effect ;)
     
  9. Offline

    ampayne2

    Ah sorry I wasn't aware of PotionMeta, thought you still had to listen to potion drink/splash events and modify the effects there :p
     
  10. Offline

    r0llingthund3r

    Hmm... using this code
    Code:
    meta.addCustomEffect(PotionEffectType.SPEED.createEffect(20*10, 1), true);
    yields this result:
    Speed II (0:10)
    which is what I'm trying to avoid.
     
  11. Offline

    _LB

    You have changed the requirements of your original post. before you just wanted custom effects on a potion of a certain color, now you want the custom effects to be hidden. As I sated earlier, you can use the HideFlags.
     
  12. Offline

    r0llingthund3r

    _LB I apologize that "remove it entirely" didn't get my point across. :p Could you please explain what these HideFlags are? I looked back through the thread and don't see any mention of them.
     
  13. Offline

    _LB

    Oops, I think I backspaced the text where I mentioned them. You should ask NathanWolf how he did it, I think you have to use CB or NMS.
     
  14. Offline

    r0llingthund3r

    _LB Thank you for your help. I will PM NathanWolf and if I get an answer I will include it in the OP and mark the thread as solved.
     
    _LB likes this.
  15. Offline

    NathanWolf


    My ears are burning!

    HideFlags is a 1.8 feature, unfortunately.... I'm waiting in anticipation :)

    Supposedly that will work for all the baked-in lore, like the "Damage" on tools, the song on a record, effect on a firework charge, etc. I can't wait... I haven't actually tested this myself, though I am pre-emptively setting the flag on my items already.

    I'd also hope that sometime in 1.8. Bukkit will add an API for this flag (and Unbreakable, Invulnerable, etc....) - in the meantime you can use NMS or an NBT lib to set the flag yourself, though it won't really do anything until 1.8.
     
Thread Status:
Not open for further replies.

Share This Page