Class ClientPlayerNetworkEvent

java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.client.event.ClientPlayerNetworkEvent
Direct Known Subclasses:
ClientPlayerNetworkEvent.Clone, ClientPlayerNetworkEvent.LoggingIn, ClientPlayerNetworkEvent.LoggingOut

public abstract class ClientPlayerNetworkEvent extends net.neoforged.bus.api.Event
Fired for different client connectivity events. See the various subclasses to listen for specific events.

These events are fired on the main Forge event bus, only on the logical client.

See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Fired when the client player respawns, creating a new player instance to replace the old player instance.
    static class 
    Fired when the client player logs in to the server.
    static class 
    Fired when the client player logs out.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final net.minecraft.network.Connection
     
    private final net.minecraft.client.multiplayer.MultiPlayerGameMode
     
    private final net.minecraft.client.player.LocalPlayer
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    ClientPlayerNetworkEvent(net.minecraft.client.multiplayer.MultiPlayerGameMode multiPlayerGameMode, net.minecraft.client.player.LocalPlayer player, net.minecraft.network.Connection connection)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.network.Connection
    Returns the network connection for the player.
    net.minecraft.client.multiplayer.MultiPlayerGameMode
    Returns the multiplayer game mode controller for the player.
    net.minecraft.client.player.LocalPlayer
    Returns the player instance.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • multiPlayerGameMode

      private final net.minecraft.client.multiplayer.MultiPlayerGameMode multiPlayerGameMode
    • player

      private final net.minecraft.client.player.LocalPlayer player
    • connection

      private final net.minecraft.network.Connection connection
  • Constructor Details

    • ClientPlayerNetworkEvent

      @Internal protected ClientPlayerNetworkEvent(net.minecraft.client.multiplayer.MultiPlayerGameMode multiPlayerGameMode, net.minecraft.client.player.LocalPlayer player, net.minecraft.network.Connection connection)
  • Method Details

    • getMultiPlayerGameMode

      public net.minecraft.client.multiplayer.MultiPlayerGameMode getMultiPlayerGameMode()
      Returns the multiplayer game mode controller for the player.
      Returns:
      the multiplayer game mode controller for the player
    • getPlayer

      public net.minecraft.client.player.LocalPlayer getPlayer()
      Returns the player instance.
      Returns:
      the player instance
    • getConnection

      public net.minecraft.network.Connection getConnection()
      Returns the network connection for the player.
      Returns:
      the network connection for the player