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
Modifier and TypeFieldDescriptionboolean
Whether the owner of the storage can battle.Whether the player is viewing the battle through their player's eyes.boolean
Whether the player can move around in the world after they have entered a battle.boolean
Whether the player is looking at a GUI.protected BattleLog
boolean
Whether the player is in Mega/Z mode or not.protected PokemonStorage
protected String
The name of the player whose storage this is.The player's Pokédex.protected BigDecimal
The amount of money the player has.boolean
Whether 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, MAX_PARTY, party, PARTY_BOX_INDEX, tempParty, tempPartyColor
Fields inherited from class com.pixelmonmod.pixelmon.api.storage.PokemonStorage
hasChanged, shouldSendUpdates, storageType, trackingPlayers, uuid
-
Constructor Summary
ConstructorDescriptionPlayerPartyStorage
(UUID uuid) PlayerPartyStorage
(UUID uuid, boolean shouldSendUpdates) -
Method Summary
Modifier and TypeMethodDescriptionboolean
add
(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 theStoragePosition
that 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) boolean
void
NOTE: I could probably make this more optimized, thanks to the new storagevoid
Safely shuts down battles on the client.void
void
dropLureInLureSlot
(net.minecraft.server.level.ServerPlayer player) If the player has a lure in their lureSlot make it drop from their inventory.void
fillEntireCurryDex
(int curryDexRating) Fills in the entire curry dex with the given rating.void
fillOneCurryDexFlavor
(int curryDexPage, int curryDexFlavor, int curryDexRating) Fills in one flavor entry for one curry dish with the given rating.void
fillOneCurryDexPage
(int curryDexPage, int curryDexRating) Fills in one page of the curry dex with the given rating.Gets balance of the accountint[]
Deprecated.Gets the unique identifier of the given entitygetLure()
net.minecraft.world.item.ItemStack
float
getMultiplier
(AbstractSpawner spawner, SpawnInfo spawnInfo, float sum, float rarity) net.minecraft.server.level.ServerPlayer
getQuestData
(boolean update) Quest storage getter.int
boolean
int
Gets the number of ticks until Pixelmon grass spawns a Pokémon against the player.void
grantServerCosmetics
(ServerCosmetics... cosmetics) boolean
hasBalance
(BigDecimal amount) Checks if the account has more than the given amountboolean
isMegaItemObtained
(Species pokemon, Stats form) void
void
lockMega()
void
obtainedItem
(Species pokemon, Stats form, net.minecraft.server.level.ServerPlayer player) void
queryResourceLocationExistence
(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 tagvoid
receiveKeyInput
(int keyCode, int scanCode, int modifiers) void
receiveResourceLocationQueryResult
(UUID query, boolean result) void
registerKeyListener
(Object instance, Method callback) void
void
revokeServerCosmetics
(ServerCosmetics... cosmetics) void
void
void
set
(StoragePosition position, Pokemon pokemon) Sets the given pokemon at the given position in the storagevoid
setBalance
(BigDecimal amount) Sets the balance of the accountvoid
setCatchingCharm
(EnumFeatureState catchingCharm) void
setDayCare
(PlayerDayCare dayCare) void
setExpCharm
(EnumFeatureState expCharm) void
setHweenRobe
(EnumFeatureState hweenRobe) Deprecated.void
setLastBattle
(BattleLog lastBattle) void
void
setLureStack
(net.minecraft.world.item.ItemStack stack) void
setMarkCharm
(EnumFeatureState markCharm) void
setMegaItem
(EnumMegaItem megaItem, boolean giveChoice) void
setMegaItemsUnlocked
(EnumMegaItemsUnlocked megaItemsUnlocked) void
setOpenStorage
(PokemonStorage openStorage) void
setOvalCharm
(EnumFeatureState ovalCharm) void
setSelectedSlot
(int selectedSlot) void
setSelectedSlot
(int selectedSlot, boolean sendPacket) void
setServerCosmetics
(Set<ServerCosmetics> cosmetics) void
setShinyCharm
(EnumFeatureState shinyCharm) boolean
take
(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 VALUESvoid
void
unlockDynamax
(boolean giveChoice) void
unlockMega
(boolean giveChoice) void
Updates the cache of pokemonLevel data in the storage.void
updateSingleCurryData
(EnumCurryKey curryKey, EnumBerryFlavor cookingFlavor, EnumCurryRating rating) void
Ticks the number of ticks until Pixelmon grass spawns a Pokémon against the player.net.minecraft.nbt.CompoundTag
writeToNBT
(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, setInTemporaryMode, setInTemporaryModeClient, setOriginal, setOriginal, setTempPartyColor, swap, swap
Methods 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, validate
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.pixelmonmod.pixelmon.api.economy.BankAccount
add, add, add, hasBalance, hasBalance, hasBalance, setBalance, setBalance, setBalance, take, take, take, updatePlayer, updatePlayer
Methods 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
-
transientData
-
-
Constructor Details
-
PlayerPartyStorage
-
PlayerPartyStorage
-
-
Method Details
-
getIdentifier
Description copied from interface:BankAccount
Gets the unique identifier of the given entity- Specified by:
getIdentifier
in interfaceBankAccount
- Returns:
- The identifier
-
addAndGetPosition
Description copied from class:PokemonStorage
Adds a Pokemon to the storage and returns theStoragePosition
that it was added to. Similarly toPokemonStorage.add(Pokemon)
, if the storage is full, then in the case that it is aPlayerPartyStorage
then it will attempt to add to the PC and pass back the return value from there.- Overrides:
addAndGetPosition
in 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:PokemonStorage
Sets the given pokemon at the given position in the storage- Overrides:
set
in 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:PokemonStorage
Writes the storage to the given NBT tag- Overrides:
writeToNBT
in 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:PokemonStorage
Reads the storage from the given NBT tag- Overrides:
readFromNBT
in 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:
getShouldSave
in classPokemonStorage
-
getCurryData
public int[] getCurryData()- Overrides:
getCurryData
in classPokemonStorage
-
updateSingleCurryData
public void updateSingleCurryData(EnumCurryKey curryKey, EnumBerryFlavor cookingFlavor, EnumCurryRating rating) - Overrides:
updateSingleCurryData
in 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:BankAccount
Checks if the account has more than the given amount- Specified by:
hasBalance
in interfaceBankAccount
- Parameters:
amount
- Amount to check- Returns:
- True if the account has more
-
getBalance
Description copied from interface:BankAccount
Gets balance of the account- Specified by:
getBalance
in interfaceBankAccount
- Returns:
- The amount of money
-
setBalance
Description copied from interface:BankAccount
Sets the balance of the account- Specified by:
setBalance
in interfaceBankAccount
- Parameters:
amount
- The new balance
-
add
Description copied from interface:BankAccount
Adds 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:
add
in interfaceBankAccount
- Parameters:
amount
- The amount being added- Returns:
- true if successful
-
take
Description copied from interface:BankAccount
Take 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:
take
in 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:
getMultiplier
in interfaceRarityTweak
-
getQuestData
Quest storage getter. -
getQuestData
-
resetQuestData
public void resetQuestData() -
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
-
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
-
receiveKeyInput
public void receiveKeyInput(int keyCode, int scanCode, int modifiers) -
deregisterKeyListener
public void deregisterKeyListener() -
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
-