Creating potion types

How do you make different potion types? I have been trying to apply PotionEffectData to a potion ItemStack however it doesn’t seem to be working.

PotionEffectData potionData = Sponge.getDataManager().getManipulatorBuilder(PotionEffectData.class).get().create();
		ListValue<PotionEffect> effects = potionData.effects();
		effects.add(PotionEffect.builder().potionType(PotionEffectTypes.HEALTH_BOOST).duration(1000000).amplifier(2).build());
		potionData.set(effects);

		ItemStack itemStack = ItemStack.builder().itemType(ItemTypes.POTION).quantity(1).build();
		itemStack.offer(Keys.IS_SPLASH_POTION, true);
		itemStack.offer(potionData);

The item stack works fine and the potion effect works fine when applied to a player
However when applying the effect to an itemstack this is printed to console :
“[Server thread/WARN]: index out of bounds to set tag in tag list”

Any help would be appreciated :slightly_smiling:

Thanks
ChrisMack

1 Like

This is a bug with the ItemPotionDataProcessor using the wrong method from NBTTagList. Please open an issue on github so it can be marked and resolved asap :wink:

Okay thanks @gabizou