Class CauldronIngredientEntityEssence

java.lang.Object
wtf.choco.alchema.crafting.CauldronIngredientEntityEssence
All Implemented Interfaces:
CauldronIngredient

public class CauldronIngredientEntityEssence
extends java.lang.Object
implements CauldronIngredient
A CauldronIngredient implementation wrapped around an EntityEssenceData. The item stack must match that of a vial of entity essence.
Author:
Parker Hawke - Choco
  • Field Details

    • KEY

      public static final org.bukkit.NamespacedKey KEY
      The NamespacedKey used for this ingredient type
  • Constructor Details

    • CauldronIngredientEntityEssence

      public CauldronIngredientEntityEssence​(@NotNull @NotNull org.bukkit.entity.EntityType entityType, @NotNull @NotNull EntityEssenceEffectRegistry essenceEffectRegistry, int amount)
      Construct a new CauldronIngredientEntityEssence with a given amount.
      Parameters:
      entityType - the type of entity essence
      essenceEffectRegistry - the effect registry
      amount - the amount of essence
    • CauldronIngredientEntityEssence

      public CauldronIngredientEntityEssence​(@NotNull @NotNull org.bukkit.entity.EntityType entityType, @NotNull @NotNull EntityEssenceEffectRegistry essenceEffectRegistry)
      Construct a new CauldronIngredientEntityEssence with an amount of 1
      Parameters:
      entityType - the type of entity essence
      essenceEffectRegistry - the effect registry
    • CauldronIngredientEntityEssence

      public CauldronIngredientEntityEssence​(@NotNull @NotNull com.google.gson.JsonObject object, @NotNull @NotNull EntityEssenceEffectRegistry essenceEffectRegistry)
      Construct a new CauldronIngredientItemStack deserialized from the provided JsonObject.
      Parameters:
      object - the object from which to deserialize
      essenceEffectRegistry - the effect registry
  • Method Details

    • getKey

      @NotNull public @NotNull org.bukkit.NamespacedKey getKey()
      Description copied from interface: CauldronIngredient
      Get the key for this ingredient type.
      Specified by:
      getKey in interface CauldronIngredient
      Returns:
      the ingredient key
    • getAmount

      public int getAmount()
      Description copied from interface: CauldronIngredient
      Get the amount of this ingredient.
      Specified by:
      getAmount in interface CauldronIngredient
      Returns:
      the ingredient amount
    • asItemStack

      @Nullable public @Nullable org.bukkit.inventory.ItemStack asItemStack()
      Description copied from interface: CauldronIngredient
      Get this ingredient represented as an ItemStack, if possible.
      Specified by:
      asItemStack in interface CauldronIngredient
      Returns:
      the item stack. null if no item stack representation
    • isSimilar

      public boolean isSimilar​(@NotNull @NotNull CauldronIngredient other)
      Description copied from interface: CauldronIngredient
      Check whether this ingredient is similar to the provided ingredient. The ingredient amount is not taken into consideration when comparing.
      Specified by:
      isSimilar in interface CauldronIngredient
      Parameters:
      other - the other ingredient against which to compare
      Returns:
      true if similar, false otherwise
    • merge

      @NotNull public @NotNull CauldronIngredient merge​(@NotNull @NotNull CauldronIngredient other)
      Description copied from interface: CauldronIngredient
      Merge this ingredient with another ingredient. The result of this method should be a new ingredient with the combined amounts of this ingredient and the one passed.
      Specified by:
      merge in interface CauldronIngredient
      Parameters:
      other - the other ingredient
      Returns:
      the merged ingredient
    • adjustAmountBy

      @NotNull public @NotNull CauldronIngredient adjustAmountBy​(int amount)
      Description copied from interface: CauldronIngredient
      Return a new cauldron ingredient with the amount changed by the specified amount. The amount can be either negative or positive but must not result in a negative or zero amount (i.e. if getAmount() - amount is 0 or negative, an exception will be thrown).
      Specified by:
      adjustAmountBy in interface CauldronIngredient
      Parameters:
      amount - the change in amount to apply
      Returns:
      the new ingredient
    • drop

      @NotNull public @NotNull java.util.List<@NotNull org.bukkit.entity.Item> drop​(@NotNull @NotNull AlchemicalCauldron cauldron, @NotNull @NotNull org.bukkit.World world, @NotNull @NotNull org.bukkit.Location location)
      Description copied from interface: CauldronIngredient
      Drop this ingredient as one or more Item from the provided cauldron.

      Default implementation of this method will, if not null, drop the result of CauldronIngredient.asItemStack().

      Specified by:
      drop in interface CauldronIngredient
      Parameters:
      cauldron - the cauldron from which to drop the ingredients
      world - the world in which the cauldron resides
      location - the location at which the items should be dropped
      Returns:
      the list of Item entities that were dropped. If none, the returned list should be empty, never null
    • toJson

      @NotNull public @NotNull com.google.gson.JsonObject toJson()
      Description copied from interface: CauldronIngredient
      Serialize this ingredient to a JsonObject.
      Specified by:
      toJson in interface CauldronIngredient
      Returns:
      the serialized json
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • equals

      public boolean equals​(java.lang.Object obj)
      Overrides:
      equals in class java.lang.Object
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object