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-consumable EntityEssenceData with glowing set to false.
    EntityEssenceData​(@NotNull org.bukkit.entity.EntityType entityType, @NotNull org.bukkit.Color essenceColor, boolean glowing)
    Construct a new non-consumable EntityEssenceData.
    EntityEssenceData​(@NotNull org.bukkit.entity.EntityType entityType, @NotNull org.bukkit.Color essenceColor, boolean glowing, @Nullable EssenceConsumptionCallback consumptionCallback)
    Construct a new EntityEssenceData.
    EntityEssenceData​(@NotNull org.bukkit.entity.EntityType entityType, @NotNull org.bukkit.Color essenceColor, @Nullable EssenceConsumptionCallback consumptionCallback)
    Construct a new EntityEssenceData with glowing 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 provided ItemStack 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 provided ItemStack to more appropriately represent this essence data as an ItemStack.
    static @NotNull org.bukkit.inventory.ItemStack createEmptyVial()
    Create an ItemStack representing an empty vial.
    static @NotNull org.bukkit.inventory.ItemStack createEmptyVial​(int amount)
    Create an ItemStack representing an empty vial.
    @NotNull org.bukkit.inventory.ItemStack createItemStack​(int essenceAmount)
    Create an ItemStack that encapsulates this essence data in an inventory.
    @NotNull org.bukkit.inventory.ItemStack createItemStack​(int essenceAmount, int amount)
    Create an ItemStack 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 provided ItemStack.
    static @Nullable org.bukkit.entity.EntityType getEntityEssenceType​(@Nullable org.bukkit.inventory.ItemStack item)
    Get the EntityType for which the provided ItemStack represents.
    @NotNull org.bukkit.entity.EntityType getEntityType()
    Get the EntityType to which this essence data belongs.
    @NotNull org.bukkit.Color getEssenceColor()
    Get the Color 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 provided ItemStack 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 new EntityEssenceData.
      Parameters:
      entityType - the target entity type
      essenceColor - the colour of the essence bottle
      glowing - whether or not the essence bottle should glow
      consumptionCallback - 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 new EntityEssenceData with glowing set to false.
      Parameters:
      entityType - the target entity type
      essenceColor - the colour of the essence bottle
      consumptionCallback - 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-consumable EntityEssenceData.
      Parameters:
      entityType - the target entity type
      essenceColor - the colour of the essence bottle
      glowing - 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-consumable EntityEssenceData with glowing set to false.
      Parameters:
      entityType - the target entity type
      essenceColor - the colour of the essence bottle
  • Method Details

    • getEntityType

      @NotNull public @NotNull org.bukkit.entity.EntityType getEntityType()
      Get the EntityType to which this essence data belongs.
      Returns:
      the entity type
    • getEssenceColor

      @NotNull public @NotNull org.bukkit.Color getEssenceColor()
      Get the Color 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 that hasConsumptionCallback() is false), this method will do nothing and return false.
      Parameters:
      player - the player to which the effect should be applied
      item - the vial that was consumed
      Returns:
      true if an effect was applied, false otherwise
    • getConsumptionCallback

      @Nullable public @Nullable EssenceConsumptionCallback getConsumptionCallback()
      Get the consumption callback.
      Returns:
      the consumption callback
    • createItemStack

      @NotNull public @NotNull org.bukkit.inventory.ItemStack createItemStack​(int essenceAmount, int amount)
      Create an ItemStack that encapsulates this essence data in an inventory.
      Parameters:
      essenceAmount - the amount of essence in the vial
      amount - the amount of the item to create
      Returns:
      the item
    • createItemStack

      @NotNull public @NotNull org.bukkit.inventory.ItemStack createItemStack​(int essenceAmount)
      Create an ItemStack 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 provided ItemStack to more appropriately represent this essence data as an ItemStack.
      Parameters:
      item - the item to update
      essenceAmount - 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 provided ItemStack 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 provided ItemStack 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 the EntityType for which the provided ItemStack 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 provided ItemStack.
      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 an ItemStack 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 an ItemStack representing an empty vial.
      Returns:
      the item