public class Potion extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Potion.Tier
Deprecated.
|
Constructor and Description |
---|
Potion(int name)
Create a potion with a specific name.
|
Potion(PotionType type)
Construct a new potion of the given type.
|
Potion(PotionType type,
int level)
Create a new potion of the given type and level.
|
Potion(PotionType type,
int level,
boolean splash)
Deprecated.
In favour of using
Potion(PotionType) with splash() . |
Potion(PotionType type,
int level,
boolean splash,
boolean extended)
Deprecated.
In favour of using
Potion(PotionType) with extend() and possibly splash() . |
Potion(PotionType type,
Potion.Tier tier)
Deprecated.
In favour of
Potion(PotionType, int) |
Potion(PotionType type,
Potion.Tier tier,
boolean splash)
Deprecated.
In favour of
Potion(PotionType, int, boolean) |
Potion(PotionType type,
Potion.Tier tier,
boolean splash,
boolean extended)
Deprecated.
In favour of
Potion(PotionType, int, boolean,
boolean) |
Modifier and Type | Method and Description |
---|---|
void |
apply(ItemStack to)
Applies the effects of this potion to the given
ItemStack . |
void |
apply(LivingEntity to)
Applies the effects that would be applied by this potion to the given
LivingEntity . |
boolean |
equals(Object obj) |
Potion |
extend()
Chain this to the constructor to extend the potion's duration.
|
static Potion |
fromDamage(int damage)
Deprecated.
Magic value
|
static Potion |
fromItemStack(ItemStack item) |
static PotionBrewer |
getBrewer()
Returns an instance of
PotionBrewer . |
Collection<PotionEffect> |
getEffects()
|
int |
getLevel()
Returns the level of this potion.
|
int |
getNameId()
Deprecated.
Magic value
|
Potion.Tier |
getTier()
Deprecated.
|
PotionType |
getType()
Returns the
PotionType of this potion. |
boolean |
hasExtendedDuration()
Returns whether this potion has an extended duration.
|
int |
hashCode() |
boolean |
isSplash()
Returns whether this potion is a splash potion.
|
void |
setHasExtendedDuration(boolean isExtended)
Set whether this potion has extended duration.
|
void |
setLevel(int level)
Sets the level of this potion.
|
static void |
setPotionBrewer(PotionBrewer other)
Sets the current instance of
PotionBrewer . |
void |
setSplash(boolean isSplash)
Sets whether this potion is a splash potion.
|
void |
setTier(Potion.Tier tier)
Deprecated.
In favour of
setLevel(int) |
void |
setType(PotionType type)
Sets the
PotionType of this potion. |
Potion |
splash()
Chain this to the constructor to make the potion a splash potion.
|
short |
toDamageValue()
Deprecated.
Magic value
|
ItemStack |
toItemStack(int amount)
Converts this potion to an
ItemStack with the specified amount
and a correct damage value. |
public Potion(PotionType type)
PotionType.WATER
, it will be level one, without extended duration.
Don't use this constructor to create a no-effect potion other than
water bottle.type
- The potion typePotion(int)
@Deprecated public Potion(PotionType type, Potion.Tier tier)
Potion(PotionType, int)
type
- the type of the potiontier
- the tier of the potion@Deprecated public Potion(PotionType type, Potion.Tier tier, boolean splash)
Potion(PotionType, int, boolean)
type
- the type of the potiontier
- the tier of the potionsplash
- whether the potion is a splash potion@Deprecated public Potion(PotionType type, Potion.Tier tier, boolean splash, boolean extended)
Potion(PotionType, int, boolean,
boolean)
type
- the type of the potiontier
- the tier of the potionsplash
- whether the potion is a splash potionextended
- whether the potion has an extended durationpublic Potion(PotionType type, int level)
type
- The type of potion.level
- The potion's level.@Deprecated public Potion(PotionType type, int level, boolean splash)
Potion(PotionType)
with splash()
.type
- The type of potion.level
- The potion's level.splash
- Whether it is a splash potion.@Deprecated public Potion(PotionType type, int level, boolean splash, boolean extended)
Potion(PotionType)
with extend()
and possibly splash()
.type
- The type of potion.level
- The potion's level.splash
- Whether it is a splash potion.extended
- Whether it has an extended duration.public Potion(int name)
name
- The name index (0-63)public Potion splash()
public Potion extend()
public void apply(ItemStack to)
ItemStack
. The
ItemStack must be a potion.to
- The itemstack to apply topublic void apply(LivingEntity to)
LivingEntity
.to
- The entity to apply the effects toLivingEntity.addPotionEffects(Collection)
public Collection<PotionEffect> getEffects()
PotionBrewer.getEffectsFromDamage(int)
,
toDamageValue()
public int getLevel()
@Deprecated public Potion.Tier getTier()
Potion.Tier
of this potion.public PotionType getType()
PotionType
of this potion.public boolean hasExtendedDuration()
public boolean isSplash()
public void setHasExtendedDuration(boolean isExtended)
isExtended
- Whether the potion should have extended durationpublic void setSplash(boolean isSplash)
isSplash
- Whether this is a splash potion@Deprecated public void setTier(Potion.Tier tier)
setLevel(int)
Potion.Tier
of this potion.tier
- The new tier of this potionpublic void setType(PotionType type)
PotionType
of this potion.type
- The new type of this potionpublic void setLevel(int level)
level
- The new level of this potion@Deprecated public short toDamageValue()
public ItemStack toItemStack(int amount)
ItemStack
with the specified amount
and a correct damage value.amount
- The amount of the ItemStack@Deprecated public static Potion fromDamage(int damage)
damage
- the damage valuepublic static PotionBrewer getBrewer()
PotionBrewer
.public static void setPotionBrewer(PotionBrewer other)
PotionBrewer
. Generally not to be
used from within a plugin.other
- The new PotionBrewer@Deprecated public int getNameId()
Copyright © 2015. All rights reserved.