public class PlayerDayCare
extends java.lang.Object
Constructor and Description |
---|
PlayerDayCare(PlayerPartyStorage party)
Default constructor taking just the party
|
Modifier and Type | Method and Description |
---|---|
void |
addHistory(Pokemon pokemon)
Adds a Pokémon to the history
Even if both parents are Ditto it will display as an egg.
|
void |
addHistory(Pokemon pokemon,
boolean bothParentsDitto)
Adds a Pokémon to the history
It will not display as an egg unless both of its parents are Ditto.
|
static PlayerDayCare |
decode(PlayerPartyStorage storage,
net.minecraft.network.PacketBuffer buffer)
Decodes the boxes from the buffer
|
void |
encode(net.minecraft.network.PacketBuffer buffer)
Encodes the boxes to the buffer
|
int |
getAllowedBoxes()
Gets the number of allowed ranch boxes the player has
|
java.util.Optional<DayCareBox> |
getBox(int boxId)
Attempts to get the ranch box at the given index
|
Pokemon |
getEgg()
The last egg sent to the client
|
DayCareBox |
getFirstEmptyBox()
Finds the first box that is empty in the Player's Day Care storage
"first" being found via logical id (i.e.
|
java.util.List<PokemonBase> |
getHistory()
Gets the Pokemon breeding history
|
java.util.Optional<DayCareBox> |
getOrCreateBox(int boxId)
Attempts to get the ranch box at the given index, and creates one if there isn't one there
|
java.util.UUID |
getParentOne()
The first parent for the current egg
|
java.util.UUID |
getParentTwo()
The second parent for the current egg
|
PlayerPartyStorage |
getParty()
Gets the parent party storage
|
boolean |
hasBox(int boxId)
Returns true if the daycare has a given box
|
boolean |
hasPaidFor(Pokemon pokemon)
Checks if the player has previously paid for this Pokemon
|
boolean |
isFull()
Checks if the player has any empty boxes in their daycare
|
static PlayerDayCare |
readFromNBT(PlayerPartyStorage party,
net.minecraft.nbt.CompoundNBT nbt)
Creates a day care instance from the NBT
|
void |
reset()
Clears the day care data
|
void |
setAllowedBoxes(int allowedBoxes)
Sets the number of allowed ranch boxes the player can have
|
void |
setBox(DayCareBox box)
Replaces the box with the same id as the one given
|
void |
setEgg(Pokemon egg) |
void |
setHistory(java.util.List<PokemonBase> history) |
void |
setPaidFor(Pokemon pokemon)
Sets the Pokemon as having been paid for (proxy for
setPaidFor(Pokemon, boolean) |
void |
setPaidFor(Pokemon pokemon,
boolean paidFor)
Sets if the Pokemon has been paid for previously
|
void |
setParentOne(java.util.UUID parentOne) |
void |
setParentTwo(java.util.UUID parentTwo) |
void |
tick()
Called to tick the day care boxes and check if the breeding time is complete
|
void |
updateHistory(Pokemon pokemon)
Tries to find the Pokémon in the history and then update it.
|
void |
writeToNBT(net.minecraft.nbt.CompoundNBT nbt)
Writes the day care to NBT
|
public PlayerDayCare(PlayerPartyStorage party)
party
- The player's partypublic void reset()
public boolean hasPaidFor(Pokemon pokemon)
pokemon
- Pokemon being checkedpublic void setPaidFor(Pokemon pokemon)
setPaidFor(Pokemon, boolean)
pokemon
- The pokemonpublic void setPaidFor(Pokemon pokemon, boolean paidFor)
pokemon
- The pokemonpaidFor
- If they have, or have not, previously been paid forpublic void setAllowedBoxes(int allowedBoxes)
allowedBoxes
- The new number of allowed boxespublic int getAllowedBoxes()
public java.util.Optional<DayCareBox> getOrCreateBox(int boxId)
boxId
- The ranch box indexpublic java.util.Optional<DayCareBox> getBox(int boxId)
boxId
- The ranch box indexpublic boolean hasBox(int boxId)
boxId
- The ranch box index@Nullable public DayCareBox getFirstEmptyBox()
public PlayerPartyStorage getParty()
public boolean isFull()
public void setBox(DayCareBox box)
box
- The box being setpublic java.util.List<PokemonBase> getHistory()
public void addHistory(Pokemon pokemon)
pokemon
- The Pokémon to add as history (will be cloned)public void addHistory(Pokemon pokemon, boolean bothParentsDitto)
pokemon
- The Pokémon to add as history (will be cloned)bothParentsDitto
- Whether the child is an offspring of two ditto parents.public void setHistory(java.util.List<PokemonBase> history)
public void updateHistory(Pokemon pokemon)
pokemon
- The newly hatched Pokémon.public java.util.UUID getParentOne()
public java.util.UUID getParentTwo()
public Pokemon getEgg()
public void setParentOne(java.util.UUID parentOne)
public void setParentTwo(java.util.UUID parentTwo)
public void setEgg(Pokemon egg)
public void tick()
public void encode(net.minecraft.network.PacketBuffer buffer)
buffer
- The packet bufferpublic static PlayerDayCare decode(PlayerPartyStorage storage, net.minecraft.network.PacketBuffer buffer)
storage
- The player's partybuffer
- The buffer encoded topublic void writeToNBT(net.minecraft.nbt.CompoundNBT nbt)
nbt
- The NBT writing topublic static PlayerDayCare readFromNBT(PlayerPartyStorage party, net.minecraft.nbt.CompoundNBT nbt)
party
- The player party (parent)nbt
- The NBT reading from