Class DayCareBox
java.lang.Object
com.pixelmonmod.pixelmon.api.storage.breeding.DayCareBox
All data pertaining to one of the player's daycare boxes in their
PlayerPartyStorage
- Since:
- 23/07/2022
-
Constructor Summary
ConstructorDescriptionDayCareBox
(PlayerDayCare dayCare, int boxId) Constructor taking the daycare (parent) and the box's id -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDayCare
(Pokemon parentOne, Pokemon parentTwo, Pokemon egg) Adds the Pokemon to the daycare box and sets up the breeding conditionsvoid
Begins the breeding processList<net.minecraft.network.chat.Component>
Gets all the remaining requirement error messagesboolean
Checks if the breeding can begin or if more conditions need to be metboolean
void
complete()
Skips all existing requirements, and timers.void
completeCondition
(DayCareCondition condition) Completes the condition and attempts to mark if the box is ready to breedstatic DayCareBox
decode
(PlayerDayCare dayCare, net.minecraft.network.FriendlyByteBuf buffer) Decodes the data from a packet buffervoid
empty()
Sets the day care box as emptyvoid
encode
(net.minecraft.network.FriendlyByteBuf buffer) Encodes the data to the packet bufferList<net.minecraft.network.chat.Component>
int
getBoxId()
Gets the ID of the daycare boxGets all the current conditions for a Day Care boxgetEgg()
Gets the egg in the box Null if not created yetnet.minecraft.network.chat.Component
int
Gets the number of silver hourglasses used on this boxGets the next condition in the list for breeding to be able to begin Will return null if there's none leftboolean
Gets whether the Oval Charm was set to ACTIVE before starting this box.getParent
(int id) Gets the parent in the slot Id Will return null if it's an invalid indexGets the first parentGets the second parentdouble
Gets the completion percentage of the daycare boxlong
Gets the duration of the breedboolean
Checks if the breeding timer has begunboolean
isEmpty()
Checks if thePlayerDayCare
box has any Pokemon in itstatic DayCareBox
readFromNBT
(PlayerDayCare dayCare, net.minecraft.nbt.CompoundTag nbt) Crates a daycare instance from NBTvoid
Returns the egg and parents to the player's party/pcvoid
setAllErrorMessages
(List<net.minecraft.network.chat.Component> allErrorMessages) void
setDayCare
(PlayerDayCare dayCare) Sets the daycarevoid
Sets the egg in the boxvoid
setHourglassesUsed
(int hourglassesUsed) Sets the number of silver hourglasses used on this boxvoid
setReadyToBreed
(boolean readyToBreed) void
setStatus
(net.minecraft.network.chat.Component errorMessage, boolean canConsume) void
tick()
Runs the tick task to check the completionvoid
writeToNBT
(net.minecraft.nbt.CompoundTag nbt) Writes the data to the NBT
-
Constructor Details
-
DayCareBox
Constructor taking the daycare (parent) and the box's id- Parameters:
dayCare
- The daycareboxId
- The box
-
-
Method Details
-
getBoxId
public int getBoxId()Gets the ID of the daycare box- Returns:
- The daycare box ID
-
setDayCare
Sets the daycare- Parameters:
dayCare
- The new daycare
-
completeCondition
Completes the condition and attempts to mark if the box is ready to breed- Parameters:
condition
- The condition
-
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
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
Gets the first parent- Returns:
- The first parent
-
getParentTwo
Gets the second parent- Returns:
- The second parent
-
getEgg
Gets the egg in the box Null if not created yet- Returns:
- The egg created
-
setEgg
Sets the egg in the box- Parameters:
egg
- The egg
-
addDayCare
Adds the Pokemon to the daycare box and sets up the breeding conditions- Parameters:
parentOne
- The first parentparentTwo
- The second parentegg
- 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
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
Gets all the current conditions for a Day Care box- Returns:
- List of conditions for the given box
-
isEmpty
public boolean isEmpty()Checks if thePlayerDayCare
box has any Pokemon in it- Returns:
- True if empty
-
getErrorMessage
public net.minecraft.network.chat.Component getErrorMessage() -
getAllErrorMessages
-
setAllErrorMessages
-
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
Crates a daycare instance from NBT- Parameters:
dayCare
- The daycarenbt
- 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 daycarebuffer
- The buffer- Returns:
- The created box
-