public class Potion extends IForgeRegistryEntry.Impl<Potion>
IForgeRegistryEntry.Impl<T extends IForgeRegistryEntry<T>>
Modifier and Type | Field and Description |
---|---|
static RegistryNamespaced<ResourceLocation,Potion> |
REGISTRY |
delegate
Modifier | Constructor and Description |
---|---|
protected |
Potion(boolean isBadEffectIn,
int liquidColorIn) |
Modifier and Type | Method and Description |
---|---|
void |
affectEntity(Entity source,
Entity indirectSource,
EntityLivingBase entityLivingBaseIn,
int amplifier,
double health) |
void |
applyAttributesModifiersToEntity(EntityLivingBase entityLivingBaseIn,
AbstractAttributeMap attributeMapIn,
int amplifier) |
double |
getAttributeModifierAmount(int amplifier,
AttributeModifier modifier) |
java.util.Map<IAttribute,AttributeModifier> |
getAttributeModifierMap() |
java.util.List<ItemStack> |
getCurativeItems()
Get a fresh list of items that can cure this Potion.
|
static int |
getIdFromPotion(Potion potionIn)
Gets the numeric Id associated with a potion.
|
int |
getLiquidColor()
Returns the color of the potion liquid.
|
java.lang.String |
getName()
returns the name of the potion
|
static Potion |
getPotionById(int potionID)
Gets a Potion from the potion registry using a numeric Id.
|
static java.lang.String |
getPotionDurationString(PotionEffect p_188410_0_,
float p_188410_1_) |
static Potion |
getPotionFromResourceLocation(java.lang.String location) |
int |
getStatusIconIndex()
Returns the index for the icon to display when the potion is active.
|
boolean |
hasStatusIcon()
Returns true if the potion has a associated status icon to display in then inventory when active.
|
boolean |
isBadEffect()
This method returns true if the potion effect is bad - negative - for the entity.
|
boolean |
isBeneficial()
Get if the potion is beneficial to the player.
|
boolean |
isInstant()
Returns true if the potion has an instant effect instead of a continuous one (eg Harming)
|
boolean |
isReady(int duration,
int amplifier)
checks if Potion effect is ready to be applied this tick.
|
void |
performEffect(EntityLivingBase entityLivingBaseIn,
int p_76394_2_) |
Potion |
registerPotionAttributeModifier(IAttribute attribute,
java.lang.String uniqueId,
double ammount,
int operation)
Used by potions to register the attribute they modify.
|
static void |
registerPotions() |
void |
removeAttributesModifiersFromEntity(EntityLivingBase entityLivingBaseIn,
AbstractAttributeMap attributeMapIn,
int amplifier) |
void |
renderHUDEffect(int x,
int y,
PotionEffect effect,
Minecraft mc,
float alpha)
Called to draw the this Potion onto the player's ingame HUD when it's active.
|
void |
renderInventoryEffect(int x,
int y,
PotionEffect effect,
Minecraft mc)
Called to draw the this Potion onto the player's inventory when it's active.
|
Potion |
setBeneficial()
Set that the potion is beneficial to the player.
|
protected Potion |
setEffectiveness(double effectivenessIn) |
protected Potion |
setIconIndex(int p_76399_1_,
int p_76399_2_)
Sets the index for the icon displayed in the player's inventory when the status is active.
|
Potion |
setPotionName(java.lang.String nameIn)
Set the potion name.
|
boolean |
shouldRender(PotionEffect effect)
If the Potion effect should be displayed in the players inventory
|
boolean |
shouldRenderHUD(PotionEffect effect)
If the Potion effect should be displayed in the player's ingame HUD
|
boolean |
shouldRenderInvText(PotionEffect effect)
If the standard PotionEffect text (name and duration) should be drawn when this potion is active.
|
getRegistryName, getRegistryType, setRegistryName, setRegistryName, setRegistryName
public static final RegistryNamespaced<ResourceLocation,Potion> REGISTRY
public static Potion getPotionById(int potionID)
public static int getIdFromPotion(Potion potionIn)
public static Potion getPotionFromResourceLocation(java.lang.String location)
protected Potion setIconIndex(int p_76399_1_, int p_76399_2_)
public void performEffect(EntityLivingBase entityLivingBaseIn, int p_76394_2_)
public void affectEntity(Entity source, Entity indirectSource, EntityLivingBase entityLivingBaseIn, int amplifier, double health)
public boolean isReady(int duration, int amplifier)
public boolean isInstant()
public Potion setPotionName(java.lang.String nameIn)
public java.lang.String getName()
protected Potion setEffectiveness(double effectivenessIn)
public boolean hasStatusIcon()
public int getStatusIconIndex()
public boolean isBadEffect()
public static java.lang.String getPotionDurationString(PotionEffect p_188410_0_, float p_188410_1_)
public int getLiquidColor()
public Potion registerPotionAttributeModifier(IAttribute attribute, java.lang.String uniqueId, double ammount, int operation)
public void removeAttributesModifiersFromEntity(EntityLivingBase entityLivingBaseIn, AbstractAttributeMap attributeMapIn, int amplifier)
public java.util.Map<IAttribute,AttributeModifier> getAttributeModifierMap()
public void applyAttributesModifiersToEntity(EntityLivingBase entityLivingBaseIn, AbstractAttributeMap attributeMapIn, int amplifier)
public double getAttributeModifierAmount(int amplifier, AttributeModifier modifier)
public boolean shouldRender(PotionEffect effect)
effect
- the active PotionEffectpublic boolean shouldRenderInvText(PotionEffect effect)
effect
- the active PotionEffectpublic boolean shouldRenderHUD(PotionEffect effect)
effect
- the active PotionEffectpublic void renderInventoryEffect(int x, int y, PotionEffect effect, Minecraft mc)
x
- the x coordinatey
- the y coordinateeffect
- the active PotionEffectmc
- the Minecraft instance, for conveniencepublic void renderHUDEffect(int x, int y, PotionEffect effect, Minecraft mc, float alpha)
x
- the x coordinatey
- the y coordinateeffect
- the active PotionEffectmc
- the Minecraft instance, for conveniencealpha
- the alpha value, blinks when the potion is about to run outpublic java.util.List<ItemStack> getCurativeItems()
PotionEffect.getCurativeItems()
public boolean isBeneficial()
public Potion setBeneficial()
public static void registerPotions()