Class ClientBattleManager
java.lang.Object
com.pixelmonmod.pixelmon.client.gui.battles.ClientBattleManager
The client-side manager for battles.
-
Field Summary
Modifier and TypeFieldDescriptionint
The amount of time before the AFK handler takes over.boolean
Whether the AFK handler is making moves.boolean
Whether the AFK handler is enabled.int
The time that the player has been AFK.int
The amount of time before the AFK handler makes a move.The player's battle bag.int
The index of the battle controller for the battle the player is in.boolean
Whether the player's battle has ended.Whether the player is viewing their battle in first person and not with the battle camera.Whether the battle screen ui elements are disabled/prevented from being rendered while the player is viewing the battle.int
Current turn.The type of battle the player is involved in.boolean
Whether the current Pokémon can flee from battle.boolean
Whether the current Pokémon can switch.int
The current catch combo.boolean
Whether the player is currently choosing a Pokémon.int
The index of the Pokémon currently selecting a move.Pokémon owned by allies of the player that are displayed in the battle GUI.The opposing Pokémon displayed in the battle GUI.Pokémon owned by the player that are displayed in the battle GUI.float
Whether the player will forfeit their battle if they move much further away.boolean
boolean
Whether the player has chosen to Dynamax the current Pokémon.int
boolean
Whether a flee attempt has failed in this switch.The Pokémon owned by the player that will evolve.boolean
Whether the player can move around while they are in a battle.All the Pokémon on the player's team while in a battle.boolean
boolean
boolean
int
The amount to heal the player's Pokémon by.boolean
Whether the player's Pokémon is healing.boolean
Whether the player is spectating a battle.The item to be used by the player.org.apache.commons.lang3.tuple.Pair<BagSection,
ItemData> Pokémon owned by the player that have leveled up.float
The ID of the currently Mega Evolved/Ultra Burst/Dynamaxed Pokémon.boolean
Whether the player has chosen to Mega Evolve or Ultra Burst the current Pokémon.float
protected AtomicReference<BattleMode>
Attacks to be learned by the player's Pokémon.protected BattleMode
A list of Pokémon to choose actions for.boolean
Whether the player can flee (click the "Run" button) when they need to switch Pokémon.The rules currently in effect for the battle.The actions that the player has currently selected for the battle turn.int
The index of the attack selected by the player.Sends packets to the server.boolean
The UUID of the player being spectated.int
The index of the bag to begin displaying items at.boolean[][]
The Pokémon being targeted by an attack.UUID[]
The Pokémon on the player's team that are on the field while in a battle.Current terrain.static final Timer
boolean
boolean
Whether the "waiting" text is visible.Current weather.The mode of the battle where the yes/no GUI was triggered from. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addBattleMessage
(BattleTaskPacket message) Adds a battle message that will be displayed to the player.void
addMessage
(String s) Adds a battle message to the player's message list.void
addMessage
(String key, Object... arguments) Adds a battle message to the player's message list.void
Chooses a move with the AFK handler.boolean
Checks if the opponent can be caught in a Poké Ball.boolean
Checks if the player is allowed to Dynamax.boolean
boolean
boolean
Checks if the player is allowed to Mega Evolve.boolean
Checks if the player is allowed to Mega Evolve.boolean
boolean
boolean
boolean
void
Checks if the player has cleared all messages, and triggers the cleared message event if so.void
Stops/Starts the rendering of the battle UI.void
Causes the player to stop spectating a battle.void
Switches between a 1st Person and 3rd Person perspective in battle.void
Ends the move selection phase and sends the decisions to the server.getBagItems
(BagSection section) Gets the Pokémon currently awaiting action.Gets the Pokémon entity corresponding to a Pokémon UUIDgetMode()
net.minecraft.world.entity.Entity
getPokemon
(UUID uuid) Gets a Pokémon in the battle the player is in.getUserPokemon
(CameraMode mode) Gets the Pokémon currently awaiting action.net.minecraft.world.entity.Entity
Gets the entity the camera is focused on.net.minecraft.world.entity.player.Player
Gets the player being spectated.boolean
Checks if any of the player's Pokémon have leveled up.boolean
Checks if the player has any more messages to be displayed.boolean
Checks if the player has any more tasks to be run.boolean
Checks if any of the player's Pokémon are learning new attacks.boolean
Checks if the player is battling in a battle (not including spectating).boolean
isEnemyPokemon
(PixelmonClientData pokemon) Checks if the Pokémon is on the opposing side.boolean
Does not include tasks that are running parallel.void
onTick
(net.minecraftforge.event.TickEvent.ClientTickEvent event) Ticks the battle.void
void
void
Resets the AFK time limit.void
Resets the camera to focus on the player.void
Marks the battle as ended.void
Handles the selection of an action by the player.void
selectedMove
(boolean isEnforcedSwitch) Handles the selection of an action by the player.void
selectRunAction
(UUID pokemonUUID) Attempts to forfeit or flee the battle.void
Triggers when the player's battle messages are emptied.void
Keeps the Pokémon camera in third-person mode.void
Keeps the player camera in first-person mode.void
setFullTeamData
(PixelmonClientData[] data) Sets the data for all our available Pokémon in battle.void
setMode
(BattleMode mode) void
setMode
(BattleMode mode, BattleMode oldMode) void
setOpponents
(PixelmonClientData[] data) Sets the Pokémon on the opposing side of the battle.void
setPokeballEntityId
(int pokeballEntityId) void
setTeamData
(PixelmonClientData[] data) Sets the data for allied Pokémon in battle.void
setTeamPokemon
(PixelmonClientData[] data) Sets the Pokémon on the player's side of the battle.void
setTeamPokemon
(UUID[] pokemon) Sets the Pokémon on the player's side of the battle.void
Enables the team select timer if it is active.void
setViewEntity
(net.minecraft.world.entity.Entity entity) Sets the camera's focus to an entity.void
startBattle
(int battleControllerIndex, boolean canCatch, boolean isForfeit, int afkActivate, int afkTurn, BattleRules rules, List<PixelmonClientData> team, List<PixelmonClientData> allies, List<UUID> battlingPokemon, List<PixelmonClientData> opponentBattlingPokemon, BattleType battleType) void
startPicking
(List<Boolean> canSwitch, boolean canFlee, ArrayList<UUID> pokemonToChoose) Begins the move picking phase of battle.void
-
Field Details
-
TIMER
-
battleControllerIndex
public int battleControllerIndexThe index of the battle controller for the battle the player is in. -
mode
-
oldMode
-
bagSection
The player's battle bag. -
battleEnded
public boolean battleEndedWhether the player's battle has ended. -
isSpectating
public boolean isSpectatingWhether the player is spectating a battle. -
teamPokemon
The Pokémon on the player's team that are on the field while in a battle. -
displayedEnemyPokemon
The opposing Pokémon displayed in the battle GUI. -
displayedOurPokemon
Pokémon owned by the player that are displayed in the battle GUI. -
displayedAllyPokemon
Pokémon owned by allies of the player that are displayed in the battle GUI. -
fullOurPokemon
All the Pokémon on the player's team while in a battle. -
levelUpList
Pokémon owned by the player that have leveled up. -
newAttackList
Attacks to be learned by the player's Pokémon. -
startIndex
public int startIndexThe index of the bag to begin displaying items at. -
itemToUse
The item to be used by the player. -
lastItem
-
sections
-
sendPacket
Sends packets to the server. -
yesNoOrigin
The mode of the battle where the yes/no GUI was triggered from. -
evolveList
The Pokémon owned by the player that will evolve. -
isHealing
public boolean isHealingWhether the player's Pokémon is healing. -
enforcedFleeFailed
public boolean enforcedFleeFailedWhether a flee attempt has failed in this switch. -
preventFleeOnSwitch
public boolean preventFleeOnSwitchWhether the player can flee (click the "Run" button) when they need to switch Pokémon. This should be true when a Pokémon switches out due to an ability, item, or move. -
healAmount
public int healAmountThe amount to heal the player's Pokémon by. -
selectedAttack
public int selectedAttackThe index of the attack selected by the player. -
currentPokemon
public int currentPokemonThe index of the Pokémon currently selecting a move. -
targetted
public boolean[][] targettedThe Pokémon being targeted by an attack. -
choosingPokemon
public boolean choosingPokemonWhether the player is currently choosing a Pokémon. -
battleTurn
public int battleTurnCurrent turn. -
weather
Current weather. -
terrain
Current terrain. -
catchCombo
public int catchComboThe current catch combo. -
selectedActions
The actions that the player has currently selected for the battle turn. -
battleType
The type of battle the player is involved in. -
afkOn
public boolean afkOnWhether the AFK handler is enabled. -
afkActive
public boolean afkActiveWhether the AFK handler is making moves. -
afkActivate
public int afkActivateThe amount of time before the AFK handler takes over. -
afkTurn
public int afkTurnThe amount of time before the AFK handler makes a move. -
afkTime
public int afkTimeThe time that the player has been AFK. -
waitingText
public boolean waitingTextWhether the "waiting" text is visible. -
battlePerspective
Whether the player is viewing their battle in first person and not with the battle camera. -
battleScreenDisabled
Whether the battle screen ui elements are disabled/prevented from being rendered while the player is viewing the battle. -
freeToMoveDuringBattle
public boolean freeToMoveDuringBattleWhether the player can move around while they are in a battle. -
distanceUntilBattleForfeited
public float distanceUntilBattleForfeitedWhether the player will forfeit their battle if they move much further away. -
minDistanceUntilVignette
public float minDistanceUntilVignette -
maxDistanceUntilBattleForfeited
public float maxDistanceUntilBattleForfeited -
megaEvolving
public boolean megaEvolvingWhether the player has chosen to Mega Evolve or Ultra Burst the current Pokémon. -
dynamaxing
public boolean dynamaxingWhether the player has chosen to Dynamax the current Pokémon. -
megaEvolution
The ID of the currently Mega Evolved/Ultra Burst/Dynamaxed Pokémon. -
ultraBurst
-
dynamax
-
hasUltraBurst
public boolean hasUltraBurst -
hasDynamaxed
public boolean hasDynamaxed -
dynamaxTurnsLeft
public int dynamaxTurnsLeft -
dynamaxDisabled
public boolean dynamaxDisabled -
gigantamax
public boolean gigantamax -
showZMoves
public boolean showZMoves -
usedZMove
public boolean usedZMove -
oldGen
-
rules
The rules currently in effect for the battle. -
canSwitch
public boolean canSwitchWhether the current Pokémon can switch. -
canFlee
public boolean canFleeWhether the current Pokémon can flee from battle. -
pokemonToChoose
A list of Pokémon to choose actions for. -
spectatingUUID
The UUID of the player being spectated.
-
-
Constructor Details
-
ClientBattleManager
public ClientBattleManager()
-
-
Method Details
-
isBattling
public boolean isBattling()Checks if the player is battling in a battle (not including spectating).- Returns:
- Whether the player is battling in a battle.
-
addMessage
Adds a battle message to the player's message list.- Parameters:
s
- The message to add.
-
addMessage
Adds a battle message to the player's message list. -
getNextBattleTask
-
removeBattleTask
public void removeBattleTask() -
hasMoreMessages
public boolean hasMoreMessages()Checks if the player has any more messages to be displayed.- Returns:
- Whether the player has more messages to be displayed.
-
hasMoreTasks
public boolean hasMoreTasks()Checks if the player has any more tasks to be run.- Returns:
- Whether the player has more messages to be displayed.
-
addBattleMessage
Adds a battle message that will be displayed to the player.- Parameters:
message
- The message to add.
-
processBattleTasks
public void processBattleTasks() -
isProcessingTask
public boolean isProcessingTask()Does not include tasks that are running parallel.- Returns:
- true if the gui is still processing a message or task.
-
sendParticipantReady
public void sendParticipantReady()Triggers when the player's battle messages are emptied. -
checkClearedMessages
public void checkClearedMessages()Checks if the player has cleared all messages, and triggers the cleared message event if so. -
getCurrentPokemon
Gets the Pokémon currently awaiting action.- Returns:
- The data for the Pokémon currently awaiting action, or null if there isn't one.
-
getUserPokemon
-
getUserPokemon
Gets the Pokémon currently awaiting action.- Parameters:
mode
-- Returns:
- Gets the Pokémon entity currently awaiting action, or null if there isn't one.
-
getEntity
Gets the Pokémon entity corresponding to a Pokémon UUID- Parameters:
uuid
- The UUID of the Pokémon- Returns:
- The specified Pokémon entity, or null if there isn't one.
-
hasLevelUps
public boolean hasLevelUps()Checks if any of the player's Pokémon have leveled up.- Returns:
- Whether any of the player's Pokémon have leveled up.
-
hasNewAttacks
public boolean hasNewAttacks()Checks if any of the player's Pokémon are learning new attacks.- Returns:
- Whether any of the player's Pokémon are learning new attacks.
-
startBattle
public void startBattle(int battleControllerIndex, boolean canCatch, boolean isForfeit, int afkActivate, int afkTurn, BattleRules rules, List<PixelmonClientData> team, List<PixelmonClientData> allies, List<UUID> battlingPokemon, List<PixelmonClientData> opponentBattlingPokemon, BattleType battleType) -
startSpectate
public void startSpectate() -
endSpectate
public void endSpectate()Causes the player to stop spectating a battle. -
endUsingBattleCamera
public void endUsingBattleCamera()Switches between a 1st Person and 3rd Person perspective in battle. -
disableBattleUIButton
public void disableBattleUIButton()Stops/Starts the rendering of the battle UI. -
onTick
public void onTick(net.minecraftforge.event.TickEvent.ClientTickEvent event) Ticks the battle.- Parameters:
event
- The triggering tick event.
-
restoreSettingsAndClose
public void restoreSettingsAndClose()Marks the battle as ended. -
canCatchOpponent
public boolean canCatchOpponent()Checks if the opponent can be caught in a Poké Ball.- Returns:
- Whether the opponent can be caught in a Poké Ball.
-
canForfeit
public boolean canForfeit() -
getViewPlayer
public net.minecraft.world.entity.player.Player getViewPlayer()Gets the player being spectated.- Returns:
- The player being spectated.
-
startPicking
Begins the move picking phase of battle.- Parameters:
canSwitch
- Whether the Pokémon can switch.canFlee
- Whether the player can flee from battle.pokemonToChoose
- A list of Pokémon to choose actions for.
-
selectedMove
public void selectedMove()Handles the selection of an action by the player. -
selectedMove
public void selectedMove(boolean isEnforcedSwitch) Handles the selection of an action by the player.- Parameters:
isEnforcedSwitch
- Whether the action was an enforced switch.
-
afkSelectMove
public void afkSelectMove()Chooses a move with the AFK handler. -
finishSelection
public void finishSelection()Ends the move selection phase and sends the decisions to the server. -
setTeamPokemon
Sets the Pokémon on the player's side of the battle.- Parameters:
pokemon
- The Pokémon on the player's side of the battle.
-
setTeamPokemon
Sets the Pokémon on the player's side of the battle.- Parameters:
data
- The Pokémon on the player's side of the battle.
-
setOpponents
Sets the Pokémon on the opposing side of the battle.- Parameters:
data
- The Pokémon on the opposing side of the battle.
-
setTeamData
Sets the data for allied Pokémon in battle.- Parameters:
data
- The allied Pokémon.
-
setFullTeamData
Sets the data for all our available Pokémon in battle.- Parameters:
data
- Our available Pokémon.
-
getPokemon
Gets a Pokémon in the battle the player is in.- Parameters:
uuid
- The UUID of the Pokémon.- Returns:
- The Pokémon with the UUID, or null if the UUID is not found.
-
isEnemyPokemon
Checks if the Pokémon is on the opposing side.- Parameters:
pokemon
- The Pokémon to check.- Returns:
- Whether the Pokémon is on the opposing side.
-
getBagItems
-
setCameraToPixelmon
public void setCameraToPixelmon()Keeps the Pokémon camera in third-person mode. -
setCameraToPlayer
public void setCameraToPlayer()Keeps the player camera in first-person mode. -
setViewEntity
public void setViewEntity(net.minecraft.world.entity.Entity entity) Sets the camera's focus to an entity.- Parameters:
entity
- The entity to focus the camera at.
-
getViewEntity
public net.minecraft.world.entity.Entity getViewEntity()Gets the entity the camera is focused on.- Returns:
- The entity the camera is focused on.
-
resetViewEntity
public void resetViewEntity()Resets the camera to focus on the player. -
resetAFKTime
public void resetAFKTime()Resets the AFK time limit. -
setTeamSelectTime
public void setTeamSelectTime()Enables the team select timer if it is active. -
getLastUsedItemIfStillAvailable
-
selectRunAction
Attempts to forfeit or flee the battle. -
canMegaEvolve
public boolean canMegaEvolve()Checks if the player is allowed to Mega Evolve.- Returns:
- Whether the player is allowed to Mega Evolve.
-
canDynamax
public boolean canDynamax()Checks if the player is allowed to Dynamax.- Returns:
- Whether the player is allowed to Dynamax.
-
canMegaEvolve
Checks if the player is allowed to Mega Evolve. and the pokemon is capable- Returns:
- Whether the player is allowed to Mega Evolve.
-
canUltraBurst
public boolean canUltraBurst() -
canUltraBurst
-
canDynamax
-
canUseZMove
public boolean canUseZMove() -
canUseZMove
-
getPokeballEntity
public net.minecraft.world.entity.Entity getPokeballEntity() -
setPokeballEntityId
public void setPokeballEntityId(int pokeballEntityId) -
setMode
-
setMode
-
getMode
-
getOldMode
-