Interface BattleMessaging
- All Superinterfaces:
BattleSimulationContext,BattleSpectating,BattleStateView,ContextHolder
- All Known Subinterfaces:
BattleController
- All Known Implementing Classes:
MultiLaneBattleController,StandardBattleController
Provides battle communication and client update operations.
This interface groups together packet broadcasting, battle messages, and
common client-side battle updates. Implementations should respect
BattleSimulationContext.disableCommunication() where appropriate so simulated battles, copied
battles, tests, or silent battle contexts do not send messages or packets to
clients.
Message helpers also record battle messages in the BattleLog so the
battle log remains consistent with what was sent to participants and
spectators.
-
Method Summary
Modifier and TypeMethodDescriptionvoidbroadcastPacket(PixelmonPacket packet) Broadcasts a battle packet to all relevant battle clients.default voidSends a translated battle message to all battle participants and spectators.default voidsendToAll(net.minecraft.network.chat.Component message) Sends a battle message to all battle participants and records it in the battle log.default voidsendToOthers(String string, BattleParticipant excluded, Object... data) Sends a translated battle message to all battle participants and spectators except the specified participant.default voidsendToOthers(net.minecraft.network.chat.Component message, BattleParticipant excluded) Sends a battle message to all battle participants and spectators except the specified participant, then records it in the battle log.default voidsendToPlayer(net.minecraft.world.entity.player.Player player, net.minecraft.network.chat.Component message) Sends a battle message to a single player and records it in the battle log.default voidupdateFormChange(PixelmonWrapper pokemon) Broadcasts a form-change update for the specified Pokémon.Methods inherited from interface com.pixelmonmod.pixelmon.battles.controller.BattleSimulationContext
copy, disableCommunication, freeze, isFrozen, isLevelingDisabled, isSimulatedBattle, shouldSpawnEntities, unfreeze, waitTicks, waitTicksMethods inherited from interface com.pixelmonmod.pixelmon.battles.controller.BattleSpectating
isSpectating, removeSpectator, spectate, spectatorsMethods inherited from interface com.pixelmonmod.pixelmon.battles.controller.BattleStateView
actionIndex, battleEnded, battleIndex, battleIndex, battleLog, battleTicks, battleTicksPerSecond, battleTurn, containsParticipantType, getActiveFaintedPokemon, getActivePokemon, getActiveUnfaintedPokemon, getBattleType, getParticipantForEntity, getParticipantFromPokemon, getParticipants, getPartyPokemonFromUUID, getPlayer, getPlayer, getPlayerEntities, getPlayers, getPokemonFromUUID, getStage, globalStatusController, isInverseBattle, isPvE, isPvP, isRaid, isTeamDefeated, isTeamHomogeneous, isWaiting, oldGen, oldGen, onBattlefield, otherParticipant, outcome, participants, playerCount, team, teams, timeElapsedMethods inherited from interface com.pixelmonmod.pixelmon.battles.controller.context.ContextHolder
get, getContext, getOrDefault, has, remove, set, update
-
Method Details
-
broadcastPacket
Broadcasts a battle packet to all relevant battle clients.Implementations should avoid sending packets when battle communication is disabled.
- Parameters:
packet- the packet to broadcast
-
sendToAll
Sends a translated battle message to all battle participants and spectators.- Parameters:
string- the translation key for the messagedata- the translation arguments
-
sendToAll
default void sendToAll(net.minecraft.network.chat.Component message) Sends a battle message to all battle participants and records it in the battle log.- Parameters:
message- the message to send
-
sendToOthers
Sends a translated battle message to all battle participants and spectators except the specified participant.- Parameters:
string- the translation key for the messageexcluded- the participant to exclude from the messagedata- the translation arguments
-
sendToOthers
Sends a battle message to all battle participants and spectators except the specified participant, then records it in the battle log.- Parameters:
message- the message to sendexcluded- the participant to exclude from the message
-
sendToPlayer
default void sendToPlayer(net.minecraft.world.entity.player.Player player, net.minecraft.network.chat.Component message) Sends a battle message to a single player and records it in the battle log.No message is sent if the player is
nullor battle communication is disabled.- Parameters:
player- the player to send the message tomessage- the message to send
-
updateFormChange
Broadcasts a form-change update for the specified Pokémon.- Parameters:
pokemon- the Pokémon whose form changed
-