Class PlayerPartyStorage
java.lang.Object
com.pixelmonmod.pixelmon.api.storage.PokemonStorage
com.pixelmonmod.pixelmon.api.storage.PartyStorage
com.pixelmonmod.pixelmon.api.storage.PlayerPartyStorage
- All Implemented Interfaces:
BankAccount,RarityTweak,Iterable<Pokemon>
-
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanWhether the owner of the storage can battle.Whether the player is viewing the battle through their player's eyes.booleanWhether the player can move around in the world after they have entered a battle.booleanWhether the player is looking at a GUI.protected BattleLogbooleanWhether the player is in Mega/Z mode or not.protected PokemonStorageprotected StringThe name of the player whose storage this is.The player's Pokédex.protected BigDecimalThe amount of money the player has.booleanWhether the player has picked a starter yetThe player's battle stats.The player's current teleport position with the Teleport/Fly external moves.The color of the players Trainer Card.Fields inherited from class com.pixelmonmod.pixelmon.api.storage.PartyStorage
cachePosition, entity, MAX_PARTY, party, PARTY_BOX_INDEX, tempParty, tempPartyColorFields inherited from class com.pixelmonmod.pixelmon.api.storage.PokemonStorage
hasChanged, shouldSendUpdates, storageType, trackingPlayers, uuid -
Constructor Summary
ConstructorsConstructorDescriptionPlayerPartyStorage(UUID uuid) PlayerPartyStorage(UUID uuid, boolean shouldSendUpdates) -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(BigDecimal amount) Adds the amount to the current balance Returns false if the transaction fails for any given reason (check console logs) DO NOT PASS NEGATIVE VALUESaddAndGetPosition(Pokemon pokemon) Adds a Pokemon to the storage and returns theStoragePositionthat it was added to.addSilently(Pokemon pokemon) Advanced method for adding Pokémon to player storage.addTaskForBattleEnd(BattleEndTaskType type, Consumer<Optional<BattleController>> consumer) Add a task to be executed once the client has left the battle UI.battle(net.minecraft.server.level.ServerPlayer player) battle(net.minecraft.server.level.ServerPlayer player, BattleType type) battle(net.minecraft.server.level.ServerPlayer target, BattleRules rules) booleanvoidNOTE: I could probably make this more optimized, thanks to the new storagevoidClears all cooldownsvoidSafely shuts down battles on the client.voiddeRegisterKeyListener(PlayerKeyListener keyListener) De-registers a key listener from the player.voidDe-registers all key listeners from the player.voiddropLureInLureSlot(net.minecraft.server.level.ServerPlayer player) If the player has a lure in their lureSlot make it drop from their inventory.voidfillEntireCurryDex(int curryDexRating) Fills in the entire curry dex with the given rating.voidfillOneCurryDexFlavor(int curryDexPage, int curryDexFlavor, int curryDexRating) Fills in one flavor entry for one curry dish with the given rating.voidfillOneCurryDexPage(int curryDexPage, int curryDexRating) Fills in one page of the curry dex with the given rating.Gets balance of the accountint[]net.minecraft.world.entity.EntityDeprecated.Gets the unique identifier of the given entitylonggetLastExecutionTime(@NotNull net.minecraft.resources.ResourceLocation key) Gets the last recorded time that the associated key has stored
This will return 0 if the key has not been recorded beforegetLure()net.minecraft.world.item.ItemStackfloatgetMultiplier(AbstractSpawner spawner, SpawnInfo spawnInfo, float sum, float rarity) net.minecraft.server.level.ServerPlayerintbooleanintGets the number of ticks until Pixelmon grass spawns a Pokémon against the player.voidgrantServerCosmetics(ServerCosmetics... cosmetics) booleanhasBalance(BigDecimal amount) Checks if the account has more than the given amountbooleanisMegaItemObtained(Species pokemon, Stats form) voidvoidlockMega()voidobtainedItem(Species pokemon, Stats form, net.minecraft.server.level.ServerPlayer player) booleanonCooldown(@NotNull net.minecraft.resources.ResourceLocation key, long cooldown) Checks if the amount of time (in milliseconds) has passed since the last recorded time that the associated key has storedbooleanonCooldown(@NotNull net.minecraft.resources.ResourceLocation key, long cooldown, @NotNull TimeUnit timeUnit) Checks if the amount of time in has passed since the last recorded time that the associated key has storedvoidqueryResourceLocationExistence(net.minecraft.resources.ResourceLocation resource, Consumer<Boolean> result) Query existence of a ResourceLocation on the client.CompletableFuture<? extends PlayerPartyStorage>readFromNBT(net.minecraft.nbt.CompoundTag nbt) Reads the storage from the given NBT tagvoidreceiveKeyInput(int keyCode, int scanCode, int modifiers) Receives key input events from the client and forwards them to the registered key listeners.voidreceiveResourceLocationQueryResult(UUID query, boolean result) voidregisterKeyListener(PlayerKeyListener keyListener) Registers a key listener that will receive key input events from the client.voidremoveCooldown(@NotNull net.minecraft.resources.ResourceLocation key) Removes the cooldown of the associated keyvoidrevokeServerCosmetics(ServerCosmetics... cosmetics) voidvoidvoidset(StoragePosition position, Pokemon pokemon) Sets the given pokemon at the given position in the storagevoidsetBalance(BigDecimal amount) Sets the balance of the accountvoidsetCatchingCharm(EnumFeatureState catchingCharm) voidsetDayCare(PlayerDayCare dayCare) voidsetExpCharm(EnumFeatureState expCharm) voidsetHweenRobe(EnumFeatureState hweenRobe) Deprecated.voidsetLastBattle(BattleLog lastBattle) voidsetLastExecutionTime(@NotNull net.minecraft.resources.ResourceLocation key) Sets the last recorded time that the associated key has stored to the current timevoidsetLastExecutionTime(@NotNull net.minecraft.resources.ResourceLocation key, long time) Sets the last recorded time that the associated key has storedvoidvoidsetLureStack(net.minecraft.world.item.ItemStack stack) voidsetMarkCharm(EnumFeatureState markCharm) voidsetMegaItem(EnumMegaItem megaItem, boolean giveChoice) voidsetMegaItemsUnlocked(EnumMegaItemsUnlocked megaItemsUnlocked) voidsetOpenStorage(PokemonStorage openStorage) voidsetOvalCharm(EnumFeatureState ovalCharm) voidsetSelectedSlot(int selectedSlot) voidsetSelectedSlot(int selectedSlot, boolean sendPacket) voidsetServerCosmetics(Set<ServerCosmetics> cosmetics) voidsetShinyCharm(EnumFeatureState shinyCharm) booleantake(BigDecimal amount) Take the amount to the current balance Returns false if the transaction fails for any given reason (check console logs) DO NOT PASS NEGATIVE VALUESvoidvoidunlockDynamax(boolean giveChoice) voidunlockMega(boolean giveChoice) voidUpdates the cache of pokemonLevel data in the storage.voidupdateSingleCurryData(EnumCurryKey curryKey, EnumBerryFlavor cookingFlavor, EnumCurryRating rating) voidTicks the number of ticks until Pixelmon grass spawns a Pokémon against the player.net.minecraft.nbt.CompoundTagwriteToNBT(net.minecraft.nbt.CompoundTag nbt) Writes the storage to the given NBT tagMethods inherited from class com.pixelmonmod.pixelmon.api.storage.PartyStorage
clear, copyToTemporaryMode, countAblePokemon, decode, encode, enterTemporaryMode, enterTemporaryMode, findFirst, findFirstPokemon, get, get, get, getAll, getAllPositions, getAndSendOutFirstAblePokemon, getAverageLevel, getFirstAblePokemon, getFirstBattleReadyPokemon, getFirstEmptyPosition, getHighestLevel, getLowestLevel, getOriginalParty, getPosition, getSlot, getSlot, getTeam, getTeam, getTempPartyColor, heal, inTemporaryMode, isOldGen, iterator, maxSize, sendCacheToPlayer, set, setEntity, setInTemporaryMode, setInTemporaryModeClient, setOriginal, setOriginal, setTempPartyColor, swap, swapMethods inherited from class com.pixelmonmod.pixelmon.api.storage.PokemonStorage
add, canTransfer, clone, countAll, countEggs, countEmpty, countPokemon, find, findAll, findAll, findAllPositions, findAllPositions, findOne, findOne, getOwner, getStorageType, getUniqueId, hasSpace, initialize, isTracking, notifyListeners, open, retrieveAll, setHasChanged, setNeedsSaving, shouldSendUpdates, shouldSendUpdates, toString, track, trackingPlayers, transfer, untrack, validateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.pixelmonmod.pixelmon.api.economy.BankAccount
add, add, add, hasBalance, hasBalance, hasBalance, setBalance, setBalance, setBalance, take, take, take, updatePlayer, updatePlayerMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
playerName
The name of the player whose storage this is. -
trainerCardColor
The color of the players Trainer Card. -
teleportPos
The player's current teleport position with the Teleport/Fly external moves. -
pokeDollars
The amount of money the player has. -
playerPokedex
The player's Pokédex. -
stats
The player's battle stats. -
guiOpened
public boolean guiOpenedWhether the player is looking at a GUI. -
battleScreenDisabled
Whether the player is viewing the battle through their player's eyes. -
freeToMoveDuringBattle
public boolean freeToMoveDuringBattleWhether the player can move around in the world after they have entered a battle. -
battleEnabled
public boolean battleEnabledWhether the owner of the storage can battle. -
starterPicked
public boolean starterPickedWhether the player has picked a starter yet -
oldGen
public boolean oldGenWhether the player is in Mega/Z mode or not. -
playerData
-
lastBattle
-
openStorage
-
cooldowns
-
transientData
-
-
Constructor Details
-
PlayerPartyStorage
-
PlayerPartyStorage
-
-
Method Details
-
getIdentifier
Description copied from interface:BankAccountGets the unique identifier of the given entity- Specified by:
getIdentifierin interfaceBankAccount- Returns:
- The identifier
-
getEntity
public net.minecraft.world.entity.Entity getEntity()- Overrides:
getEntityin classPartyStorage
-
addAndGetPosition
Description copied from class:PokemonStorageAdds a Pokemon to the storage and returns theStoragePositionthat it was added to. Similarly toPokemonStorage.add(Pokemon), if the storage is full, then in the case that it is aPlayerPartyStoragethen it will attempt to add to the PC and pass back the return value from there.- Overrides:
addAndGetPositionin classPokemonStorage- Parameters:
pokemon- The Pokemon to add to the storage.- Returns:
- The position that the Pokemon was added to. Null if the Pokemon could not be added.
-
addSilently
Advanced method for adding Pokémon to player storage. Returns a tristate enum representing what happened. Does not send any messages to the player, you're expected to handle this yourself here.- Parameters:
pokemon- Pokémon object to add to storage.- Returns:
- TRUE = added to party, FALSE = added to PC, NULL = failed to add
-
tryUpdatePlayerName
public void tryUpdatePlayerName() -
getPlayer
@Nullable public net.minecraft.server.level.ServerPlayer getPlayer() -
getPlayerName
-
getPlayerUUID
-
set
Description copied from class:PokemonStorageSets the given pokemon at the given position in the storage- Overrides:
setin classPartyStorage- Parameters:
position- the position to set the pokemonpokemon- the pokemon to set
-
writeToNBT
public net.minecraft.nbt.CompoundTag writeToNBT(net.minecraft.nbt.CompoundTag nbt) Description copied from class:PokemonStorageWrites the storage to the given NBT tag- Overrides:
writeToNBTin classPartyStorage- Parameters:
nbt- the NBT tag to write to- Returns:
- the NBT tag with the storage written to it
-
readFromNBT
public CompletableFuture<? extends PlayerPartyStorage> readFromNBT(net.minecraft.nbt.CompoundTag nbt) Description copied from class:PokemonStorageReads the storage from the given NBT tag- Overrides:
readFromNBTin classPartyStorage- Parameters:
nbt- the NBT tag to read from- Returns:
- a future that completes when the storage has been read from the NBT tag
-
getShouldSave
public boolean getShouldSave()- Overrides:
getShouldSavein classPokemonStorage
-
getCurryData
public int[] getCurryData()- Overrides:
getCurryDatain classPokemonStorage
-
updateSingleCurryData
public void updateSingleCurryData(EnumCurryKey curryKey, EnumBerryFlavor cookingFlavor, EnumCurryRating rating) - Overrides:
updateSingleCurryDatain classPokemonStorage
-
fillOneCurryDexFlavor
public void fillOneCurryDexFlavor(int curryDexPage, int curryDexFlavor, int curryDexRating) Fills in one flavor entry for one curry dish with the given rating.- Parameters:
curryDexPage- The page number the desired curry dish is on.curryDexFlavor- The position of the desired flavor on a page.curryDexRating- The rating to be given to the desired flavor.
-
fillOneCurryDexPage
public void fillOneCurryDexPage(int curryDexPage, int curryDexRating) Fills in one page of the curry dex with the given rating.- Parameters:
curryDexPage- The page number of the curry dish to be filled in.curryDexRating- The rating to be given to the entire page.
-
fillEntireCurryDex
public void fillEntireCurryDex(int curryDexRating) Fills in the entire curry dex with the given rating.- Parameters:
curryDexRating- The rating to be given to the entire dex.
-
isMegaItemObtained
-
obtainedItem
-
setMegaItem
-
unlockMega
public void unlockMega(boolean giveChoice) -
lockMega
public void lockMega() -
unlockDynamax
public void unlockDynamax(boolean giveChoice) -
lockDynamax
public void lockDynamax() -
setMegaItemsUnlocked
-
setShinyCharm
-
setOvalCharm
-
setExpCharm
-
setCatchingCharm
-
setMarkCharm
-
setHweenRobe
Deprecated. -
canEquipMegaItem
public boolean canEquipMegaItem() -
getMegaItem
-
getMegaItemsUnlocked
-
getShinyCharm
-
getOvalCharm
-
getExpCharm
-
getCatchingCharm
-
getMarkCharm
-
getHweenRobe
Deprecated. -
getServerCosmetics
-
setServerCosmetics
-
grantServerCosmetics
-
revokeServerCosmetics
-
getLureStack
public net.minecraft.world.item.ItemStack getLureStack() -
getLure
-
setLureStack
public void setLureStack(net.minecraft.world.item.ItemStack stack) -
setLure
-
dropLureInLureSlot
public void dropLureInLureSlot(net.minecraft.server.level.ServerPlayer player) If the player has a lure in their lureSlot make it drop from their inventory. -
hasBalance
Description copied from interface:BankAccountChecks if the account has more than the given amount- Specified by:
hasBalancein interfaceBankAccount- Parameters:
amount- Amount to check- Returns:
- True if the account has more
-
getBalance
Description copied from interface:BankAccountGets balance of the account- Specified by:
getBalancein interfaceBankAccount- Returns:
- The amount of money
-
setBalance
Description copied from interface:BankAccountSets the balance of the account- Specified by:
setBalancein interfaceBankAccount- Parameters:
amount- The new balance
-
add
Description copied from interface:BankAccountAdds the amount to the current balance Returns false if the transaction fails for any given reason (check console logs) DO NOT PASS NEGATIVE VALUES- Specified by:
addin interfaceBankAccount- Parameters:
amount- The amount being added- Returns:
- true if successful
-
take
Description copied from interface:BankAccountTake the amount to the current balance Returns false if the transaction fails for any given reason (check console logs) DO NOT PASS NEGATIVE VALUES- Specified by:
takein interfaceBankAccount- Parameters:
amount- The amount being taken- Returns:
- true if successful
-
updatePartyCache
public void updatePartyCache()Updates the cache of pokemonLevel data in the storage. -
getTicksTillEncounter
public int getTicksTillEncounter()Gets the number of ticks until Pixelmon grass spawns a Pokémon against the player.- Returns:
- The number of ticks until Pixelmon grass spawns a Pokémon against the player.
-
updateTicksTillEncounter
public void updateTicksTillEncounter()Ticks the number of ticks until Pixelmon grass spawns a Pokémon against the player. Resets the counter if it reaches 1. -
checkPokerus
public void checkPokerus()NOTE: I could probably make this more optimized, thanks to the new storage -
getMultiplier
- Specified by:
getMultiplierin interfaceRarityTweak
-
closeBattleSafely
public void closeBattleSafely()Safely shuts down battles on the client. -
addTaskForBattleEnd
public BattleEndTaskResult addTaskForBattleEnd(BattleEndTaskType type, Consumer<Optional<BattleController>> consumer) Add a task to be executed once the client has left the battle UI. Careful, the battle controller may be null! -
battle
-
battle
-
battle
-
getLastExecutionTime
public long getLastExecutionTime(@NotNull @NotNull net.minecraft.resources.ResourceLocation key) Gets the last recorded time that the associated key has stored
This will return 0 if the key has not been recorded before- Parameters:
key- The key to check the last execution time for- Returns:
- The last recorded time that the associated key has stored
-
setLastExecutionTime
public void setLastExecutionTime(@NotNull @NotNull net.minecraft.resources.ResourceLocation key) Sets the last recorded time that the associated key has stored to the current time- Parameters:
key- The key to set the last execution time for
-
setLastExecutionTime
public void setLastExecutionTime(@NotNull @NotNull net.minecraft.resources.ResourceLocation key, long time) Sets the last recorded time that the associated key has stored- Parameters:
key- The key to set the last execution time fortime- The time to set the last execution time to
-
onCooldown
public boolean onCooldown(@NotNull @NotNull net.minecraft.resources.ResourceLocation key, long cooldown, @NotNull @NotNull TimeUnit timeUnit) Checks if the amount of time in has passed since the last recorded time that the associated key has stored- Parameters:
key- The key to check the cooldown forcooldown- The amount of time to check fortimeUnit- The time unit to check the cooldown in- Returns:
- If the amount of time in has passed since the last recorded time that the associated key has stored
-
onCooldown
public boolean onCooldown(@NotNull @NotNull net.minecraft.resources.ResourceLocation key, long cooldown) Checks if the amount of time (in milliseconds) has passed since the last recorded time that the associated key has stored- Parameters:
key- The key to check the cooldown forcooldown- The amount of time to check for- Returns:
- If the amount of time has passed since the last recorded time that the associated key has stored
-
removeCooldown
public void removeCooldown(@NotNull @NotNull net.minecraft.resources.ResourceLocation key) Removes the cooldown of the associated key- Parameters:
key- The key to remove the cooldown of
-
clearCooldowns
public void clearCooldowns()Clears all cooldowns -
queryResourceLocationExistence
public void queryResourceLocationExistence(net.minecraft.resources.ResourceLocation resource, Consumer<Boolean> result) Query existence of a ResourceLocation on the client.- Parameters:
resource- ResourceLocation to be queried.result- Consumer to be executed with the result of the query.
-
receiveResourceLocationQueryResult
-
registerKeyListener
Registers a key listener that will receive key input events from the client.
This will only work when the player is in an inventory that has aPixelmonItems.ui_elementin it.- Parameters:
keyListener- The key listener to register
-
receiveKeyInput
@Internal public void receiveKeyInput(int keyCode, int scanCode, int modifiers) Receives key input events from the client and forwards them to the registered key listeners.
This method is called by the client when a key input event is received.
This should only be called by the packets- Parameters:
keyCode- The key code of the key that was pressedscanCode- The scan code of the key that was pressedmodifiers- The modifiers of the key that was pressed
-
deRegisterKeyListeners
public void deRegisterKeyListeners()De-registers all key listeners from the player. -
deRegisterKeyListener
De-registers a key listener from the player.- Parameters:
keyListener- The key listener to de-register
-
getSelectedSlot
public int getSelectedSlot() -
setSelectedSlot
public void setSelectedSlot(int selectedSlot) -
setSelectedSlot
public void setSelectedSlot(int selectedSlot, boolean sendPacket) -
getSelectedPokemon
-
sendClientUpdatePacket
public void sendClientUpdatePacket() -
sendClientUpdateSelectedPacket
public void sendClientUpdateSelectedPacket() -
getDayCare
-
setDayCare
-
getLastBattle
-
setLastBattle
-
getOpenStorage
-
setOpenStorage
-