Class PCBox
java.lang.Object
com.pixelmonmod.pixelmon.api.storage.PokemonStorage
com.pixelmonmod.pixelmon.api.storage.PCBox
- Direct Known Subclasses:
- PCBoxSearch
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected intprotected StoragePositionbooleanprotected Stringprotected PCStorageprotected Pokemon[]static final intprotected StringFields inherited from class com.pixelmonmod.pixelmon.api.storage.PokemonStoragehasChanged, shouldSendUpdates, storageType, trackingPlayers, uuid
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidclear()Clears all the pokemon from the storagevoiddecode(net.minecraft.network.FriendlyByteBuf buf) Reads the storage from the given buffervoidencode(net.minecraft.network.FriendlyByteBuf buffer) Writes the storage to the given bufferget(int slot) get(StoragePosition position) Gets the pokemon at the given position in the storage
 Will return null if there is no pokemon at the given positionPokemon[]getAll()Gets a array of all pokemon within this storage.Same asPokemonStorage.getAll(), but forStoragePositions.intGets the first position where there is no pokemon in the storagegetName()getPC()getPosition(Pokemon pokemon) Gets the position of the given pokemon in the storage
 Will return null if the pokemon is not in the storageintiterator()intmaxSize()readFromNBT(net.minecraft.nbt.CompoundTag nbt) Reads the storage from the given NBT tagvoidvoidsendContents(net.minecraft.server.level.ServerPlayer player) voidvoidset(StoragePosition position, Pokemon pokemon) Sets the given pokemon at the given position in the storagevoidvoidsetWallpaper(String wallpaper) booleanGets if the storage should send updates to the tracking entitiesvoidswap(int slot1, int slot2) voidswap(StoragePosition position1, StoragePosition position2) Swaps the pokemon at the given positions in the storageList<net.minecraft.server.level.ServerPlayer>Gets the list of players that are tracking the storagenet.minecraft.nbt.CompoundTagwriteToNBT(net.minecraft.nbt.CompoundTag nbt) Writes the storage to the given NBT tagMethods inherited from class com.pixelmonmod.pixelmon.api.storage.PokemonStorageadd, addAndGetPosition, canTransfer, clone, countAll, countEggs, countEmpty, countPokemon, find, findAll, findAll, findAllPositions, findAllPositions, findOne, findOne, getCurryData, getOwner, getShouldSave, getStorageType, getUniqueId, hasSpace, initialize, isTracking, notifyListeners, open, retrieveAll, setHasChanged, setNeedsSaving, shouldSendUpdates, toString, track, transfer, untrack, updateSingleCurryData, validateMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.IterableforEach, spliterator
- 
Field Details- 
POKEMON_PER_BOXpublic static final int POKEMON_PER_BOX- See Also:
 
- 
pc
- 
boxNumberprotected transient int boxNumber
- 
pokemon
- 
name
- 
wallpaper
- 
cachePosition
- 
hasChangedClientSidepublic transient boolean hasChangedClientSide
 
- 
- 
Constructor Details- 
PCBoxpublic PCBox()Only use this for JSON deserialization.
- 
PCBox
- 
PCBox
 
- 
- 
Method Details- 
encodepublic void encode(net.minecraft.network.FriendlyByteBuf buffer) Description copied from class:PokemonStorageWrites the storage to the given buffer- Specified by:
- encodein class- PokemonStorage
- Parameters:
- buffer- the buffer to write to
 
- 
decodepublic void decode(net.minecraft.network.FriendlyByteBuf buf) Description copied from class:PokemonStorageReads the storage from the given buffer- Specified by:
- decodein class- PokemonStorage
- Parameters:
- buf- the buffer to read from
 
- 
getAllDescription copied from class:PokemonStorageGets a array of all pokemon within this storage. May not be the implementations array (e.g it could be copy). So don't expect to be able to edit this. the size of the array should always match the maximum capacity and will obviously contain null elements for slots that are not full.- Specified by:
- getAllin class- PokemonStorage
- Returns:
- An array of all pokemon within this storage. By convention this is not the implementation's array (thus this is a copy). This is preferred because it forces modifications to go through the relevant methods which fire events and flip hasChanged.
 
- 
getAllPositionsDescription copied from class:PokemonStorageSame asPokemonStorage.getAll(), but forStoragePositions. Note that this will return every position, regardless of whether or not it contains a Pokemon, for flexibility.- Specified by:
- getAllPositionsin class- PokemonStorage
 
- 
maxSizepublic int maxSize()- Specified by:
- maxSizein class- PokemonStorage
- Returns:
- The maximum capacity of the Storage (or the individual containers, in cases like PCStorage)
 
- 
writeToNBTpublic net.minecraft.nbt.CompoundTag writeToNBT(net.minecraft.nbt.CompoundTag nbt) Description copied from class:PokemonStorageWrites the storage to the given NBT tag- Specified by:
- writeToNBTin class- PokemonStorage
- Parameters:
- nbt- the NBT tag to write to
- Returns:
- the NBT tag with the storage written to it
 
- 
readFromNBTDescription copied from class:PokemonStorageReads the storage from the given NBT tag- Specified by:
- readFromNBTin class- PokemonStorage
- Parameters:
- nbt- the NBT tag to read from
- Returns:
- a future that completes when the storage has been read from the NBT tag
 
- 
getPositionDescription copied from class:PokemonStorageGets the position of the given pokemon in the storage
 Will return null if the pokemon is not in the storage- Specified by:
- getPositionin class- PokemonStorage
- Parameters:
- pokemon- the pokemon to get the position of
- Returns:
- the position of the given pokemon in the storage
 
- 
trackingPlayersDescription copied from class:PokemonStorageGets the list of players that are tracking the storage- Overrides:
- trackingPlayersin class- PokemonStorage
- Returns:
- the list of players that are tracking the storage
 
- 
getSlot
- 
getFirstEmptyPositionDescription copied from class:PokemonStorageGets the first position where there is no pokemon in the storage- Specified by:
- getFirstEmptyPositionin class- PokemonStorage
- Returns:
- the first empty position in the storage
 
- 
setDescription copied from class:PokemonStorageSets the given pokemon at the given position in the storage- Specified by:
- setin class- PokemonStorage
- Parameters:
- position- the position to set the pokemon
- pokemon- the pokemon to set
 
- 
set
- 
getDescription copied from class:PokemonStorageGets the pokemon at the given position in the storage
 Will return null if there is no pokemon at the given position- Specified by:
- getin class- PokemonStorage
- Parameters:
- position- the position to get the pokemon from
- Returns:
- the pokemon at the given position
 
- 
get
- 
swapDescription copied from class:PokemonStorageSwaps the pokemon at the given positions in the storage- Specified by:
- swapin class- PokemonStorage
- Parameters:
- position1- the first position to swap
- position2- the second position to swap
 
- 
swappublic void swap(int slot1, int slot2) 
- 
sendContentspublic void sendContents(net.minecraft.server.level.ServerPlayer player) 
- 
shouldSendUpdatespublic boolean shouldSendUpdates()Description copied from class:PokemonStorageGets if the storage should send updates to the tracking entities- Overrides:
- shouldSendUpdatesin class- PokemonStorage
- Returns:
- if the storage should send updates
 
- 
getName
- 
getWallpaper
- 
iterator
- 
clearpublic void clear()Description copied from class:PokemonStorageClears all the pokemon from the storage- Specified by:
- clearin class- PokemonStorage
 
- 
getPC
- 
getBoxNumberpublic int getBoxNumber()
- 
sendChangesToServerpublic void sendChangesToServer()
- 
setName
- 
setWallpaper
 
-