Class PlayerPartyStorage

All Implemented Interfaces:
BankAccount, RarityTweak, Iterable<Pokemon>

public class PlayerPartyStorage extends PartyStorage implements BankAccount, RarityTweak
  • Field Details

    • playerName

      protected String playerName
      The name of the player whose storage this is.
    • trainerCardColor

      public EnumTrainerCardColor trainerCardColor
      The color of the players Trainer Card.
    • teleportPos

      public TeleportPosition teleportPos
      The player's current teleport position with the Teleport/Fly external moves.
    • pokeDollars

      protected BigDecimal pokeDollars
      The amount of money the player has.
    • playerPokedex

      public PlayerPokedex playerPokedex
      The player's Pokédex.
    • stats

      public PlayerStats stats
      The player's battle stats.
    • guiOpened

      public boolean guiOpened
      Whether the player is looking at a GUI.
    • battleScreenDisabled

      public BattleScreenMode battleScreenDisabled
      Whether the player is viewing the battle through their player's eyes.
    • freeToMoveDuringBattle

      public boolean freeToMoveDuringBattle
      Whether the player can move around in the world after they have entered a battle.
    • battleEnabled

      public boolean battleEnabled
      Whether the owner of the storage can battle.
    • starterPicked

      public boolean starterPicked
      Whether the player has picked a starter yet
    • oldGen

      public boolean oldGen
      Whether the player is in Mega/Z mode or not.
    • playerData

      public PlayerData playerData
    • lastBattle

      protected BattleLog lastBattle
    • openStorage

      protected PokemonStorage openStorage
    • transientData

      public transient TransientData transientData
  • Constructor Details

    • PlayerPartyStorage

      public PlayerPartyStorage(UUID uuid, boolean shouldSendUpdates)
    • PlayerPartyStorage

      public PlayerPartyStorage(UUID uuid)
  • Method Details

    • getIdentifier

      public UUID getIdentifier()
      Description copied from interface: BankAccount
      Gets the unique identifier of the given entity
      Specified by:
      getIdentifier in interface BankAccount
      Returns:
      The identifier
    • addAndGetPosition

      @Nullable public StoragePosition addAndGetPosition(Pokemon pokemon)
      Description copied from class: PokemonStorage
      Adds a Pokemon to the storage and returns the StoragePosition that it was added to. Similarly to PokemonStorage.add(Pokemon), if the storage is full, then in the case that it is a PlayerPartyStorage then it will attempt to add to the PC and pass back the return value from there.
      Overrides:
      addAndGetPosition in class PokemonStorage
      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

      public TriBoolean addSilently(Pokemon pokemon)
      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

      @Nullable public String getPlayerName()
    • getPlayerUUID

      public UUID getPlayerUUID()
    • set

      public void set(StoragePosition position, Pokemon pokemon)
      Description copied from class: PokemonStorage
      Sets the given pokemon at the given position in the storage
      Overrides:
      set in class PartyStorage
      Parameters:
      position - the position to set the pokemon
      pokemon - 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 class PartyStorage
      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 class PartyStorage
      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 class PokemonStorage
    • getCurryData

      public int[] getCurryData()
      Overrides:
      getCurryData in class PokemonStorage
    • updateSingleCurryData

      public void updateSingleCurryData(EnumCurryKey curryKey, EnumBerryFlavor cookingFlavor, EnumCurryRating rating)
      Overrides:
      updateSingleCurryData in class PokemonStorage
    • 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

      public boolean isMegaItemObtained(Species pokemon, Stats form)
    • obtainedItem

      public void obtainedItem(Species pokemon, Stats form, net.minecraft.server.level.ServerPlayer player)
    • setMegaItem

      public void setMegaItem(EnumMegaItem megaItem, boolean giveChoice)
    • unlockMega

      public void unlockMega(boolean giveChoice)
    • lockMega

      public void lockMega()
    • unlockDynamax

      public void unlockDynamax(boolean giveChoice)
    • lockDynamax

      public void lockDynamax()
    • setMegaItemsUnlocked

      public void setMegaItemsUnlocked(EnumMegaItemsUnlocked megaItemsUnlocked)
    • setShinyCharm

      public void setShinyCharm(EnumFeatureState shinyCharm)
    • setOvalCharm

      public void setOvalCharm(EnumFeatureState ovalCharm)
    • setExpCharm

      public void setExpCharm(EnumFeatureState expCharm)
    • setCatchingCharm

      public void setCatchingCharm(EnumFeatureState catchingCharm)
    • setMarkCharm

      public void setMarkCharm(EnumFeatureState markCharm)
    • setHweenRobe

      @Deprecated public void setHweenRobe(EnumFeatureState hweenRobe)
      Deprecated.
    • canEquipMegaItem

      public boolean canEquipMegaItem()
    • getMegaItem

      public EnumMegaItem getMegaItem()
    • getMegaItemsUnlocked

      public EnumMegaItemsUnlocked getMegaItemsUnlocked()
    • getShinyCharm

      public EnumFeatureState getShinyCharm()
    • getOvalCharm

      public EnumFeatureState getOvalCharm()
    • getExpCharm

      public EnumFeatureState getExpCharm()
    • getCatchingCharm

      public EnumFeatureState getCatchingCharm()
    • getMarkCharm

      public EnumFeatureState getMarkCharm()
    • getHweenRobe

      @Deprecated public EnumFeatureState getHweenRobe()
      Deprecated.
    • getServerCosmetics

      public Set<ServerCosmetics> getServerCosmetics()
    • setServerCosmetics

      public void setServerCosmetics(Set<ServerCosmetics> cosmetics)
    • grantServerCosmetics

      public void grantServerCosmetics(ServerCosmetics... cosmetics)
    • revokeServerCosmetics

      public void revokeServerCosmetics(ServerCosmetics... cosmetics)
    • getLureStack

      public net.minecraft.world.item.ItemStack getLureStack()
    • getLure

      @Nullable public LureItem getLure()
    • setLureStack

      public void setLureStack(net.minecraft.world.item.ItemStack stack)
    • setLure

      public void setLure(LureItem lure)
    • 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

      public boolean hasBalance(BigDecimal amount)
      Description copied from interface: BankAccount
      Checks if the account has more than the given amount
      Specified by:
      hasBalance in interface BankAccount
      Parameters:
      amount - Amount to check
      Returns:
      True if the account has more
    • getBalance

      public BigDecimal getBalance()
      Description copied from interface: BankAccount
      Gets balance of the account
      Specified by:
      getBalance in interface BankAccount
      Returns:
      The amount of money
    • setBalance

      public void setBalance(BigDecimal amount)
      Description copied from interface: BankAccount
      Sets the balance of the account
      Specified by:
      setBalance in interface BankAccount
      Parameters:
      amount - The new balance
    • add

      public boolean add(BigDecimal amount)
      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 interface BankAccount
      Parameters:
      amount - The amount being added
      Returns:
      true if successful
    • take

      public boolean take(BigDecimal amount)
      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 interface BankAccount
      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

      public float getMultiplier(AbstractSpawner spawner, SpawnInfo spawnInfo, float sum, float rarity)
      Specified by:
      getMultiplier in interface RarityTweak
    • getQuestData

      public QuestData getQuestData(boolean update)
      Quest storage getter.
    • getQuestData

      public QuestData 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!
    • 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

      public void receiveResourceLocationQueryResult(UUID query, boolean result)
    • registerKeyListener

      public void registerKeyListener(Object instance, Method callback)
    • 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

      public Pokemon getSelectedPokemon()
    • sendClientUpdatePacket

      public void sendClientUpdatePacket()
    • sendClientUpdateSelectedPacket

      public void sendClientUpdateSelectedPacket()
    • getDayCare

      public PlayerDayCare getDayCare()
    • setDayCare

      public void setDayCare(PlayerDayCare dayCare)
    • getLastBattle

      public BattleLog getLastBattle()
    • setLastBattle

      public void setLastBattle(BattleLog lastBattle)
    • getOpenStorage

      public PokemonStorage getOpenStorage()
    • setOpenStorage

      public void setOpenStorage(PokemonStorage openStorage)