Class ActiveConnection

Direct Known Subclasses:

public abstract class ActiveConnection extends Object
An active game connection to a single receiver (and with a single sender).
  • Constructor Details

    • ActiveConnection

      public ActiveConnection(ParentNetId rootId)
  • Method Details

    • postConstruct

      public final void postConstruct()
    • getMinecraftContext

      @Deprecated public abstract getMinecraftContext()
      Replaced by the specific methods getPlayer() and getNetSide().
      The Fabric API PacketContext for this connection. Throws an error if this is not a ActiveMinecraftConnection. (Although mods will *never* need to worry about that unless they create their own netty layer for a completely different connection).
    • getNetSide

      public EnumNetSide getNetSide()
      The "side" of this connection. If this is an ActiveMinecraftConnection then this will be CLIENT both when writing client to server packets, and when reading packets sent from the server. (And SERVER both when writing server to client packets, and when reading client to server packets). Other connection types might throw an exception if they reuse LNS for a non-standard minecraft connection.
    • getPlayer

      public net.minecraft.entity.player.PlayerEntity getPlayer()
      The Minecraft PlayerEntity for this connection. Throws an error if this is not a ActiveMinecraftConnection.
    • sendPacket

      protected abstract void sendPacket(NetByteBuf data, int packetId, @Nullable NetIdBase netId, int priority)
      packetId - The packet ID that has been written out to the first int of the given buffer.
      netId - The NetIdBase that is being written out. Will be null if the packet ID is one of the internal packets.
      priority - The priority for the packet. Will be either 0 or a negative number.
    • onReceiveRawData

      public void onReceiveRawData(NetByteBuf data) throws InvalidInputDataException