Class AlchemicalCauldron

java.lang.Object
wtf.choco.alchema.cauldron.AlchemicalCauldron

public class AlchemicalCauldron
extends java.lang.Object
Represents a special cauldron provided by Alchema. These cauldrons require a source of heat, therefore a lit flame must be present below the cauldron before it may be used to brew recipes.
Author:
Parker Hawke - 2008Choco
  • Constructor Summary

    Constructors
    Constructor Description
    AlchemicalCauldron​(@NotNull org.bukkit.block.Block block)
    Construct a new AlchemicalCauldron.
  • Method Summary

    Modifier and Type Method Description
    void addIngredient​(@NotNull CauldronIngredient ingredient)
    Add the ingredient to this cauldron.
    boolean attemptToHeatUp()
    Attempt to heat this cauldron.
    boolean canHeatUp()
    Check whether or not this cauldron may be heated up.
    void clearIngredients()
    Clear all ingredients from this cauldron.
    boolean dropIngredients​(CauldronIngredientsDropEvent.Reason reason, @Nullable org.bukkit.entity.Player player)
    Clear all ingredients from this cauldron and drop them into the world.
    boolean equals​(java.lang.Object object)  
    static @Nullable AlchemicalCauldron fromJson​(@NotNull com.google.gson.JsonObject object, @NotNull CauldronRecipeRegistry recipeRegistry)
    Read the contents of the provided JsonObject into a new AlchemicalCauldron instance.
    @NotNull org.bukkit.block.Block getCauldronBlock()
    Get the block at which the cauldron resides.
    @NotNull org.bukkit.block.Block getFireBlock()
    Deprecated.
    poor naming as heat sources can be more than just fire.
    long getHeatingStartTime()
    Get the time in milliseconds (according to System.currentTimeMillis()) at which this cauldron started heating up.
    @NotNull org.bukkit.block.Block getHeatSourceBlock()
    Get the block used as the heat source for the cauldron (below getCauldronBlock(), block y - 1)
    @NotNull org.bukkit.Location getHeatSourceLocation()
    Get the Location of this cauldron's heat source.
    int getHeatSourceX()
    Get the x coordinate of this cauldron's heat source.
    int getHeatSourceY()
    Get the y coordinate of this cauldron's heat source.
    int getHeatSourceZ()
    Get the z coordinate of this cauldron's heat source.
    @NotNull java.util.List<@NotNull CauldronIngredient> getIngredients()
    Get the ingredients present in this cauldron.
    @NotNull org.bukkit.util.BoundingBox getItemConsumptionBounds()
    Get the BoundingBox in which Item instances will be consumed by the cauldron and considered an ingredient.
    @Nullable org.bukkit.OfflinePlayer getLastInteracted()
    Get the OfflinePlayer that last interacted with this cauldron.
    @NotNull org.bukkit.Location getLocation()
    Get the Location of this cauldron.
    @NotNull org.bukkit.World getWorld()
    Get the World in which this cauldron resides.
    int getX()
    Get the x coordinate of this alchemical cauldron.
    int getY()
    Get the y coordinate of this alchemical cauldron.
    int getZ()
    Get the z coordinate of this alchemical cauldron.
    int hashCode()  
    boolean hasIngredients()
    Check whether or not this cauldron has ANY ingredients.
    boolean hasValidHeatSource()
    Check whether or not this cauldron has a valid heat source.
    boolean isBubbling()
    Check whether or not this cauldron is bubbling.
    boolean isHeatingUp()
    Check whether or not this cauldron is currently heating up.
    boolean isLoaded()
    Check whether or not this cauldron is in a loaded chunk.
    void removeIngredients​(@NotNull CauldronRecipe recipe)
    Remove the ingredients listed by the provided CauldronRecipe.
    void setBubbling​(boolean bubbling)
    Set whether or not this cauldron is bubbling.
    void setLastInteracted​(@Nullable org.bukkit.OfflinePlayer player)
    Set the OfflinePlayer that last interacted with this cauldron.
    void stopHeatingUp()
    Stop this cauldron from heating up.
    @NotNull com.google.gson.JsonObject write​(@NotNull com.google.gson.JsonObject object)
    Write and serialize this object into the given JsonObject.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AlchemicalCauldron

      public AlchemicalCauldron​(@NotNull @NotNull org.bukkit.block.Block block)
      Construct a new AlchemicalCauldron.
      Parameters:
      block - the block at which the cauldron is located
  • Method Details

    • isLoaded

      public boolean isLoaded()
      Check whether or not this cauldron is in a loaded chunk.
      Returns:
      true if loaded, false otherwise
    • getCauldronBlock

      @NotNull public @NotNull org.bukkit.block.Block getCauldronBlock()
      Get the block at which the cauldron resides.
      Returns:
      the cauldron block
    • getLocation

      @NotNull public @NotNull org.bukkit.Location getLocation()
      Get the Location of this cauldron.
      Returns:
      the cauldron location
    • getX

      public int getX()
      Get the x coordinate of this alchemical cauldron.
      Returns:
      the x coordinate
    • getY

      public int getY()
      Get the y coordinate of this alchemical cauldron.
      Returns:
      the y coordinate
    • getZ

      public int getZ()
      Get the z coordinate of this alchemical cauldron.
      Returns:
      the z coordinate
    • getWorld

      @NotNull public @NotNull org.bukkit.World getWorld()
      Get the World in which this cauldron resides.
      Returns:
      the cauldron's world
    • getFireBlock

      @NotNull @Deprecated public @NotNull org.bukkit.block.Block getFireBlock()
      Deprecated.
      poor naming as heat sources can be more than just fire. See getHeatSourceBlock() instead. This method will be removed in the near future.
      Get the block used to ignite the cauldron (below getCauldronBlock(), y-1).
      Returns:
      the fire block
    • getHeatSourceBlock

      @NotNull public @NotNull org.bukkit.block.Block getHeatSourceBlock()
      Get the block used as the heat source for the cauldron (below getCauldronBlock(), block y - 1)
      Returns:
      the heat source block
    • getHeatSourceLocation

      @NotNull public @NotNull org.bukkit.Location getHeatSourceLocation()
      Get the Location of this cauldron's heat source.
      Returns:
      the heat source location
    • getHeatSourceX

      public int getHeatSourceX()
      Get the x coordinate of this cauldron's heat source.
      Returns:
      the x coordinate
    • getHeatSourceY

      public int getHeatSourceY()
      Get the y coordinate of this cauldron's heat source.
      Returns:
      the y coordinate
    • getHeatSourceZ

      public int getHeatSourceZ()
      Get the z coordinate of this cauldron's heat source.
      Returns:
      the z coordinate
    • getItemConsumptionBounds

      @NotNull public @NotNull org.bukkit.util.BoundingBox getItemConsumptionBounds()
      Get the BoundingBox in which Item instances will be consumed by the cauldron and considered an ingredient.
      Returns:
      the consumption bounds
    • setLastInteracted

      public void setLastInteracted​(@Nullable @Nullable org.bukkit.OfflinePlayer player)
      Set the OfflinePlayer that last interacted with this cauldron.
      Parameters:
      player - the player to set
    • getLastInteracted

      @Nullable public @Nullable org.bukkit.OfflinePlayer getLastInteracted()
      Get the OfflinePlayer that last interacted with this cauldron.
      Returns:
      the player that last interacted
    • hasValidHeatSource

      public boolean hasValidHeatSource()
      Check whether or not this cauldron has a valid heat source.
      Returns:
      true if a valid heat source is present, false otherwise
    • canHeatUp

      public boolean canHeatUp()
      Check whether or not this cauldron may be heated up.
      Returns:
      true if heating is possible, false otherwise
    • attemptToHeatUp

      public boolean attemptToHeatUp()
      Attempt to heat this cauldron.
      Returns:
      true if the attempt is successful and heating has started, false otherwise
    • isHeatingUp

      public boolean isHeatingUp()
      Check whether or not this cauldron is currently heating up.
      Returns:
      true if heating up, false otherwise
    • stopHeatingUp

      public void stopHeatingUp()
      Stop this cauldron from heating up.
    • getHeatingStartTime

      public long getHeatingStartTime()
      Get the time in milliseconds (according to System.currentTimeMillis()) at which this cauldron started heating up. If the cauldron is not heating up (i.e. isHeatingUp() == false), this will return -1.
      Returns:
      the heating start time. -1 if the cauldron is not heating up
    • setBubbling

      public void setBubbling​(boolean bubbling)
      Set whether or not this cauldron is bubbling.
      Parameters:
      bubbling - the new bubbling state
    • isBubbling

      public boolean isBubbling()
      Check whether or not this cauldron is bubbling.
      Returns:
      true if bubbling, false otherwise
    • addIngredient

      public void addIngredient​(@NotNull @NotNull CauldronIngredient ingredient)
      Add the ingredient to this cauldron. If the ingredient matches that of another ingredient already in this cauldron, it will be merged.
      Parameters:
      ingredient - the ingredient to add
    • removeIngredients

      public void removeIngredients​(@NotNull @NotNull CauldronRecipe recipe)
      Remove the ingredients listed by the provided CauldronRecipe.
      Parameters:
      recipe - the recipe whose ingredients should be removed
    • hasIngredients

      public boolean hasIngredients()
      Check whether or not this cauldron has ANY ingredients.
      Returns:
      true if at least one ingredient is present, false otherwise
    • getIngredients

      @NotNull public @NotNull java.util.List<@NotNull CauldronIngredient> getIngredients()
      Get the ingredients present in this cauldron. Changes made to this List will not affect the contents of this cauldron.
      Returns:
      the ingredients
    • dropIngredients

      public boolean dropIngredients​(@Nullable CauldronIngredientsDropEvent.Reason reason, @Nullable @Nullable org.bukkit.entity.Player player)
      Clear all ingredients from this cauldron and drop them into the world.
      Parameters:
      reason - the reason for the items to be dropped. null if none
      player - the player that caused the ingredients to drop. null if none
      Returns:
      true if ingredients were cleared, false if cancelled by the CauldronIngredientsDropEvent
    • clearIngredients

      public void clearIngredients()
      Clear all ingredients from this cauldron.
    • write

      @NotNull public @NotNull com.google.gson.JsonObject write​(@NotNull @NotNull com.google.gson.JsonObject object)
      Write and serialize this object into the given JsonObject.
      Parameters:
      object - the object in which to write
      Returns:
      the modified object
    • fromJson

      @Nullable public static @Nullable AlchemicalCauldron fromJson​(@NotNull @NotNull com.google.gson.JsonObject object, @NotNull @NotNull CauldronRecipeRegistry recipeRegistry)
      Read the contents of the provided JsonObject into a new AlchemicalCauldron instance.
      Parameters:
      object - the object from which to read
      recipeRegistry - the recipe registry
      Returns:
      the cauldron
    • hashCode

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

      public boolean equals​(java.lang.Object object)
      Overrides:
      equals in class java.lang.Object