Class PacketRegistrationHandler

java.lang.Object
commonnetwork.networking.PacketRegistrationHandler
All Implemented Interfaces:
NetworkHandler, PacketRegistrar
Direct Known Subclasses:
FabricNetworkHandler

public abstract class PacketRegistrationHandler extends Object implements NetworkHandler, PacketRegistrar
  • Field Details

    • side

      protected final Side side
  • Constructor Details

    • PacketRegistrationHandler

      public PacketRegistrationHandler(Side side)
      Handles packet registration
      Parameters:
      side - - The side
  • Method Details

    • registerPacket

      public <T> PacketRegistrar registerPacket(net.minecraft.resources.ResourceLocation packetIdentifier, Class<T> packetClass, BiConsumer<T,net.minecraft.network.FriendlyByteBuf> encoder, Function<net.minecraft.network.FriendlyByteBuf,T> decoder, Consumer<PacketContext<T>> handler)
      Description copied from interface: PacketRegistrar
      Packet Registration registers a PLAY packet
      Specified by:
      registerPacket in interface PacketRegistrar
      Type Parameters:
      T - - The class type
      Parameters:
      packetIdentifier - - The unique ResourceLocation packet id.
      packetClass - - The class of the packet.
      encoder - - The encoder method.
      decoder - - The decoder method.
      handler - - The handler method.
      Returns:
      The registrar for chaining registrations.
    • registerConfigurationPacket

      public <T> PacketRegistrar registerConfigurationPacket(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<? extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> type, Class<T> packetClass, net.minecraft.network.codec.StreamCodec<? extends net.minecraft.network.FriendlyByteBuf,T> codec, Consumer<PacketContext<T>> handler)
      Description copied from interface: PacketRegistrar
      Packet Registration, registers a CONFIGURATION packet
      Specified by:
      registerConfigurationPacket in interface PacketRegistrar
      Type Parameters:
      T - - The class type
      Parameters:
      type - - The packet type.
      packetClass - - The class of the packet.
      codec - - The StreamCodec.
      handler - - The handler method.
      Returns:
      The registrar for chaining registrations.
    • registerPacket

      public <T> PacketRegistrar registerPacket(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<? extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> type, Class<T> packetClass, net.minecraft.network.codec.StreamCodec<? extends net.minecraft.network.FriendlyByteBuf,T> codec, Consumer<PacketContext<T>> handler)
      Description copied from interface: PacketRegistrar
      Packet Registration, registers a PLAY packet
      Specified by:
      registerPacket in interface PacketRegistrar
      Type Parameters:
      T - - The class type
      Parameters:
      type - - The packet type.
      packetClass - - The class of the packet.
      codec - - The StreamCodec.
      handler - - The handler method.
      Returns:
      The registrar for chaining registrations.
    • getSide

      public Side getSide()
      Specified by:
      getSide in interface PacketRegistrar
      Returns:
      the side