Interface BattleMessaging

All Superinterfaces:
BattleSimulationContext, BattleSpectating, BattleStateView, ContextHolder
All Known Subinterfaces:
BattleController
All Known Implementing Classes:
MultiLaneBattleController, StandardBattleController

public interface BattleMessaging extends BattleStateView, BattleSimulationContext, BattleSpectating
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 Details

    • broadcastPacket

      void broadcastPacket(PixelmonPacket packet)
      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

      default void sendToAll(String string, Object... data)
      Sends a translated battle message to all battle participants and spectators.
      Parameters:
      string - the translation key for the message
      data - 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

      default void sendToOthers(String string, BattleParticipant excluded, Object... data)
      Sends a translated battle message to all battle participants and spectators except the specified participant.
      Parameters:
      string - the translation key for the message
      excluded - the participant to exclude from the message
      data - the translation arguments
    • sendToOthers

      default void sendToOthers(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.
      Parameters:
      message - the message to send
      excluded - 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 null or battle communication is disabled.

      Parameters:
      player - the player to send the message to
      message - the message to send
    • updateFormChange

      default void updateFormChange(PixelmonWrapper pokemon)
      Broadcasts a form-change update for the specified Pokémon.
      Parameters:
      pokemon - the Pokémon whose form changed