[SPIGOT-3467] Potion changes to uncraftabe potion, if I change it's attributes Created: 27/Jul/17  Updated: 28/Jul/17  Resolved: 28/Jul/17

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Lolokar Productions Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: 1.11.2, spigot


 Description   

Hello, I have found this problem with potions:

When I create a potion usingĀ 

new ItemStack(Material.Potion, 1, data_value);

it creates the right Potion. So for example if I want to create a potion of regeneration, the data value will beĀ 8193. And it works fine.

But the problem appears when I change for example the name of the potion

ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.setDisplayName(name);

Now, it will change the potion into uncraftable potion and there will not be any effect on it, it's color will also change to pink.

This bug is most probably present also for lore, enchantments and item flags.



 Comments   
Comment by md_5 [ 28/Jul/17 ]

This can't be fixed when using purely Bukkit stacks.
Please use the potion API rather than effect IDs.

Comment by md_5 [ 27/Jul/17 ]

Meta should be converted however

Comment by Black Hole [ 27/Jul/17 ]

Using data values for potions is deprecated. Those data values are converted once the item is added to an inventory.
If you're running getMeta() on an item stack that don't originate from an inventory those conversations are not run and the data value ignored.

Since with 1.13 no data values will be supported anywhere, you should create the item without any data value, cast the ItemMeta to PotionMeta and use the methods there to setup the potion.

Generated at Sat Dec 13 15:22:05 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.