Creating a potion bottle, no-effect-attached

Discussion in 'Plugin Development' started by Boomer, May 18, 2014.

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

    Boomer

    For one of my plugins, i need to have two bottles of splash potions that I can give different names and lores to -- I can easily do this, creating an itemstack of any potion from the 'no-effect' list (stinky potion, acid potion, etc), such as potion id #16427 ... and they show the name I want, have a lore value that I set, and show "No Effect" in the middle of the hover-over display. Good.

    But, the two potions I make are visually the same, and bland - like water. I would like to create two different colored potions (or different colored enchanty-glows) for these items, like red and green, but without actually being a working potion, or else, that lets me wipe-out the effect on display. I do not want to actually use these bottles as player-thrown potions, they have another purpose in store, but I do want them to appear visually distinct.

    (By this i mean, if i spawn 16420 potion, I can still change the display name and lore, but it shows as Poison II, and if thrown, is poisonII.) I want a colorful, no-effect-attached potion, and I will listen for it being thrown or utilized by its lore data

    Am I asking the impossible? Is it dull same-color-blue only potion bottles for all non-effect?
    Is there a way to remove an effect from a potion item, or at least the text of it, so that it does not show in the inventory display - I can easily prevent the bottle being thrown as a potion and prevent its effects, but i dont want it saying PoisonII on the display.

    Code:
            ItemStack nanoRecieverPad = new ItemStack(Material.POTION, 1, (short)16420 ); //16384+n
            ItemMeta imR=nanoRecieverPad.getItemMeta();
            imR.setDisplayName("Reciever Construction Nanobots");
            List<String>lore = new ArrayList<String>();
            lore.add("RecieverPad");        
            imR.setLore(lore);
            nanoRecieverPad.setItemMeta(imR);
            int freeslot=p.getInventory().firstEmpty();    
            p.getInventory().setItem(freeslot, nanoRecieverPad);
     
    
     
  2. Offline

    blobic123

  3. Offline

    rsod

    You can use CustomPotionEffect to override default potion behaviour.
     
Thread Status:
Not open for further replies.

Share This Page