Package wtf.choco.alchema.essence
Class EntityEssenceData
java.lang.Object
wtf.choco.alchema.essence.EntityEssenceData
public class EntityEssenceData
extends java.lang.Object
Represents information about entity essence bottles and its properties.
- Author:
- Parker Hawke - Choco
-
Constructor Summary
Constructors Constructor Description EntityEssenceData(@NotNull org.bukkit.entity.EntityType entityType, @NotNull org.bukkit.Color essenceColor)
Construct a new non-consumableEntityEssenceData
withglowing
set to false.EntityEssenceData(@NotNull org.bukkit.entity.EntityType entityType, @NotNull org.bukkit.Color essenceColor, boolean glowing)
Construct a new non-consumableEntityEssenceData
.EntityEssenceData(@NotNull org.bukkit.entity.EntityType entityType, @NotNull org.bukkit.Color essenceColor, boolean glowing, @Nullable EssenceConsumptionCallback consumptionCallback)
Construct a newEntityEssenceData
.EntityEssenceData(@NotNull org.bukkit.entity.EntityType entityType, @NotNull org.bukkit.Color essenceColor, @Nullable EssenceConsumptionCallback consumptionCallback)
Construct a newEntityEssenceData
withglowing
set to false. -
Method Summary
Modifier and Type Method Description boolean
applyConsumptionEffectTo(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.inventory.ItemStack item)
Apply the consumption effect for this entity essence to the provided living entity.@NotNull org.bukkit.inventory.ItemStack
applyTo(@NotNull org.bukkit.inventory.ItemStack item)
Apply the required ItemMeta and change the type of the providedItemStack
to more appropriately represent this essence data as an ItemStack.@NotNull org.bukkit.inventory.ItemStack
applyTo(@NotNull org.bukkit.inventory.ItemStack item, int essenceAmount)
Apply the required ItemMeta and change the type of the providedItemStack
to more appropriately represent this essence data as an ItemStack.static @NotNull org.bukkit.inventory.ItemStack
createEmptyVial()
Create anItemStack
representing an empty vial.static @NotNull org.bukkit.inventory.ItemStack
createEmptyVial(int amount)
Create anItemStack
representing an empty vial.@NotNull org.bukkit.inventory.ItemStack
createItemStack(int essenceAmount)
Create anItemStack
that encapsulates this essence data in an inventory.@NotNull org.bukkit.inventory.ItemStack
createItemStack(int essenceAmount, int amount)
Create anItemStack
that encapsulates this essence data in an inventory.@Nullable EssenceConsumptionCallback
getConsumptionCallback()
Get the consumption callback.static int
getEntityEssenceAmount(@Nullable org.bukkit.inventory.ItemStack item)
Get the amount of essence contained in the providedItemStack
.static @Nullable org.bukkit.entity.EntityType
getEntityEssenceType(@Nullable org.bukkit.inventory.ItemStack item)
Get theEntityType
for which the providedItemStack
represents.@NotNull org.bukkit.entity.EntityType
getEntityType()
Get theEntityType
to which this essence data belongs.@NotNull org.bukkit.Color
getEssenceColor()
Get theColor
of the essence bottle item.boolean
hasConsumptionCallback()
Check whether or not this entity essence has any effect on player consumption.static boolean
isEmptyVial(@Nullable org.bukkit.inventory.ItemStack item)
Check whether or not the provided item is an empty vial.boolean
isGlowing()
Check whether or not the essence bottle item will glow.static boolean
isVialOfEntityEssence(@Nullable org.bukkit.inventory.ItemStack item)
Check whether or not the providedItemStack
is a vial of entity essence.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
EntityEssenceData
public EntityEssenceData(@NotNull @NotNull org.bukkit.entity.EntityType entityType, @NotNull @NotNull org.bukkit.Color essenceColor, boolean glowing, @Nullable @Nullable EssenceConsumptionCallback consumptionCallback)Construct a newEntityEssenceData
.- Parameters:
entityType
- the target entity typeessenceColor
- the colour of the essence bottleglowing
- whether or not the essence bottle should glowconsumptionCallback
- the applier to be run when a player consumes the essence
-
EntityEssenceData
public EntityEssenceData(@NotNull @NotNull org.bukkit.entity.EntityType entityType, @NotNull @NotNull org.bukkit.Color essenceColor, @Nullable @Nullable EssenceConsumptionCallback consumptionCallback)Construct a newEntityEssenceData
withglowing
set to false.- Parameters:
entityType
- the target entity typeessenceColor
- the colour of the essence bottleconsumptionCallback
- the applier to be run when a player consumes the essence
-
EntityEssenceData
public EntityEssenceData(@NotNull @NotNull org.bukkit.entity.EntityType entityType, @NotNull @NotNull org.bukkit.Color essenceColor, boolean glowing)Construct a new non-consumableEntityEssenceData
.- Parameters:
entityType
- the target entity typeessenceColor
- the colour of the essence bottleglowing
- whether or not the essence bottle should glow
-
EntityEssenceData
public EntityEssenceData(@NotNull @NotNull org.bukkit.entity.EntityType entityType, @NotNull @NotNull org.bukkit.Color essenceColor)Construct a new non-consumableEntityEssenceData
withglowing
set to false.- Parameters:
entityType
- the target entity typeessenceColor
- the colour of the essence bottle
-
-
Method Details
-
getEntityType
@NotNull public @NotNull org.bukkit.entity.EntityType getEntityType()Get theEntityType
to which this essence data belongs.- Returns:
- the entity type
-
getEssenceColor
@NotNull public @NotNull org.bukkit.Color getEssenceColor()Get theColor
of the essence bottle item.- Returns:
- the essence colour
-
isGlowing
public boolean isGlowing()Check whether or not the essence bottle item will glow.- Returns:
- true if glowing, false otherwise
-
hasConsumptionCallback
public boolean hasConsumptionCallback()Check whether or not this entity essence has any effect on player consumption.- Returns:
- true if an effect is applied, false otherwise
-
applyConsumptionEffectTo
public boolean applyConsumptionEffectTo(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull org.bukkit.inventory.ItemStack item)Apply the consumption effect for this entity essence to the provided living entity. If this essence data does not have any consumption effect (such thathasConsumptionCallback()
isfalse
), this method will do nothing and return false.- Parameters:
player
- the player to which the effect should be applieditem
- the vial that was consumed- Returns:
- true if an effect was applied, false otherwise
-
getConsumptionCallback
Get the consumption callback.- Returns:
- the consumption callback
-
createItemStack
@NotNull public @NotNull org.bukkit.inventory.ItemStack createItemStack(int essenceAmount, int amount)Create anItemStack
that encapsulates this essence data in an inventory.- Parameters:
essenceAmount
- the amount of essence in the vialamount
- the amount of the item to create- Returns:
- the item
-
createItemStack
@NotNull public @NotNull org.bukkit.inventory.ItemStack createItemStack(int essenceAmount)Create anItemStack
that encapsulates this essence data in an inventory.- Parameters:
essenceAmount
- the amount of essence in the vial- Returns:
- the item
-
applyTo
@NotNull public @NotNull org.bukkit.inventory.ItemStack applyTo(@NotNull @NotNull org.bukkit.inventory.ItemStack item, int essenceAmount)Apply the required ItemMeta and change the type of the providedItemStack
to more appropriately represent this essence data as an ItemStack.- Parameters:
item
- the item to updateessenceAmount
- the amount of essence to set- Returns:
- the item stack instance for convenience
-
applyTo
@NotNull public @NotNull org.bukkit.inventory.ItemStack applyTo(@NotNull @NotNull org.bukkit.inventory.ItemStack item)Apply the required ItemMeta and change the type of the providedItemStack
to more appropriately represent this essence data as an ItemStack. If the item is already a vial of essence, the amount of essence will remain the same. Else, the essence amount will be set to 1.- Parameters:
item
- the item to update- Returns:
- the item stack instance for convenience
-
isVialOfEntityEssence
public static boolean isVialOfEntityEssence(@Nullable @Nullable org.bukkit.inventory.ItemStack item)Check whether or not the providedItemStack
is a vial of entity essence.- Parameters:
item
- the item to check- Returns:
- true if it is essence, false otherwise
-
getEntityEssenceType
@Nullable public static @Nullable org.bukkit.entity.EntityType getEntityEssenceType(@Nullable @Nullable org.bukkit.inventory.ItemStack item)Get theEntityType
for which the providedItemStack
represents.This method acts under the assumption that the provided ItemStack is a vial of entity essence (i.e.
isVialOfEntityEssence(ItemStack)
is true). If this is not the case, this method will return null.- Parameters:
item
- the item to check- Returns:
- the type of entity essence
-
getEntityEssenceAmount
public static int getEntityEssenceAmount(@Nullable @Nullable org.bukkit.inventory.ItemStack item)Get the amount of essence contained in the providedItemStack
.- Parameters:
item
- the item to check- Returns:
- the amount of essence
-
isEmptyVial
public static boolean isEmptyVial(@Nullable @Nullable org.bukkit.inventory.ItemStack item)Check whether or not the provided item is an empty vial.- Parameters:
item
- the empty vial- Returns:
- true if it is an empty vial, false otherwise
-
createEmptyVial
@NotNull public static @NotNull org.bukkit.inventory.ItemStack createEmptyVial(int amount)Create anItemStack
representing an empty vial.- Parameters:
amount
- the amount of the item to create- Returns:
- the item
-
createEmptyVial
@NotNull public static @NotNull org.bukkit.inventory.ItemStack createEmptyVial()Create anItemStack
representing an empty vial.- Returns:
- the item
-