java.lang.Object
com.pixelmonmod.pixelmon.api.storage.breeding.DayCareBox

public class DayCareBox extends Object
All data pertaining to one of the player's daycare boxes in their PlayerPartyStorage
Since:
23/07/2022
  • Constructor Details

    • DayCareBox

      public DayCareBox(PlayerDayCare dayCare, int boxId)
      Constructor taking the daycare (parent) and the box's id
      Parameters:
      dayCare - The daycare
      boxId - The box
  • Method Details

    • getBoxId

      public int getBoxId()
      Gets the ID of the daycare box
      Returns:
      The daycare box ID
    • setDayCare

      public void setDayCare(PlayerDayCare dayCare)
      Sets the daycare
      Parameters:
      dayCare - The new daycare
    • completeCondition

      public void completeCondition(DayCareCondition condition)
      Completes the condition and attempts to mark if the box is ready to breed
      Parameters:
      condition - The condition
    • calculateAllErrors

      public List<net.minecraft.network.chat.Component> calculateAllErrors()
      Gets all the remaining requirement error messages
      Returns:
      the errors
    • beginBreeding

      public void beginBreeding()
      Begins the breeding process
    • hasBreedingBegun

      public boolean hasBreedingBegun()
      Checks if the breeding timer has begun
      Returns:
      True if the timer has started
    • tick

      public void tick()
      Runs the tick task to check the completion
    • getParent

      @Nullable public Pokemon getParent(int id)
      Gets the parent in the slot Id Will return null if it's an invalid index
      Parameters:
      id - The parent ID
      Returns:
      The parent
    • getParentOne

      @Nullable public Pokemon getParentOne()
      Gets the first parent
      Returns:
      The first parent
    • getParentTwo

      @Nullable public Pokemon getParentTwo()
      Gets the second parent
      Returns:
      The second parent
    • getEgg

      @Nullable public Pokemon getEgg()
      Gets the egg in the box Null if not created yet
      Returns:
      The egg created
    • setEgg

      public void setEgg(Pokemon egg)
      Sets the egg in the box
      Parameters:
      egg - The egg
    • addDayCare

      public void addDayCare(Pokemon parentOne, Pokemon parentTwo, Pokemon egg)
      Adds the Pokemon to the daycare box and sets up the breeding conditions
      Parameters:
      parentOne - The first parent
      parentTwo - The second parent
      egg - The egg
    • canBreedingBegin

      public boolean canBreedingBegin()
      Checks if the breeding can begin or if more conditions need to be met
      Returns:
      True if breeding can begin
    • getPercentComplete

      public double getPercentComplete()
      Gets the completion percentage of the daycare box
      Returns:
      The completion percentage
    • getTotalDuration

      public long getTotalDuration()
      Gets the duration of the breed
      Returns:
      The duration
    • getNextCondition

      @Nullable public DayCareCondition getNextCondition()
      Gets the next condition in the list for breeding to be able to begin Will return null if there's none left
      Returns:
      The next breeding condition required for completion
    • getConditions

      public List<DayCareCondition> getConditions()
      Gets all the current conditions for a Day Care box
      Returns:
      List of conditions for the given box
    • isEmpty

      public boolean isEmpty()
      Checks if the PlayerDayCare box has any Pokemon in it
      Returns:
      True if empty
    • getErrorMessage

      public net.minecraft.network.chat.Component getErrorMessage()
    • getAllErrorMessages

      public List<net.minecraft.network.chat.Component> getAllErrorMessages()
    • setAllErrorMessages

      public void setAllErrorMessages(List<net.minecraft.network.chat.Component> allErrorMessages)
    • canConsume

      public boolean canConsume()
    • setStatus

      public void setStatus(net.minecraft.network.chat.Component errorMessage, boolean canConsume)
    • setReadyToBreed

      public void setReadyToBreed(boolean readyToBreed)
    • setHourglassesUsed

      public void setHourglassesUsed(int hourglassesUsed)
      Sets the number of silver hourglasses used on this box
      Parameters:
      hourglassesUsed - The number used
    • getHourglassesUsed

      public int getHourglassesUsed()
      Gets the number of silver hourglasses used on this box
      Returns:
      The number used
    • getOvalCharmActive

      public boolean getOvalCharmActive()
      Gets whether the Oval Charm was set to ACTIVE before starting this box.
      Returns:
      The state of the Oval Charm.
    • complete

      public void complete()
      Skips all existing requirements, and timers. Instantly makes the breed finished (gold/diamond hourglass)
    • returnToStorage

      public void returnToStorage()
      Returns the egg and parents to the player's party/pc
    • empty

      public void empty()
      Sets the day care box as empty
    • writeToNBT

      public void writeToNBT(net.minecraft.nbt.CompoundTag nbt)
      Writes the data to the NBT
      Parameters:
      nbt - The NBT being written to
    • readFromNBT

      public static DayCareBox readFromNBT(PlayerDayCare dayCare, net.minecraft.nbt.CompoundTag nbt)
      Crates a daycare instance from NBT
      Parameters:
      dayCare - The daycare
      nbt - The NBT
      Returns:
      The daycare box instance
    • encode

      public void encode(net.minecraft.network.FriendlyByteBuf buffer)
      Encodes the data to the packet buffer
      Parameters:
      buffer - The buffer
    • decode

      public static DayCareBox decode(PlayerDayCare dayCare, net.minecraft.network.FriendlyByteBuf buffer)
      Decodes the data from a packet buffer
      Parameters:
      dayCare - The parent daycare
      buffer - The buffer
      Returns:
      The created box