Java Code Examples for net.minecraft.potion.Potion#getId()

The following examples show how to use net.minecraft.potion.Potion#getId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TippedArrow.java    From Et-Futurum with The Unlicense 5 votes vote down vote up
public static ItemStack setEffect(ItemStack stack, Potion potion, int duration) {
	stack.setTagCompound(new NBTTagCompound());
	NBTTagCompound nbt = new NBTTagCompound();
	stack.getTagCompound().setTag("Potion", nbt);

	PotionEffect effect = new PotionEffect(potion.getId(), potion.isInstant() ? 1 : duration);
	effect.writeCustomPotionEffectToNBT(nbt);

	return stack;
}