Interface PacketRegistrar

All Known Implementing Classes:
DelayedPacketRegistrationHandler, PacketRegistrationHandler

public interface PacketRegistrar
  • Method Summary

    Modifier and Type
    Method
    Description
     
    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)
    Packet Registration, registers a CONFIGURATION packet
    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)
    Packet Registration, registers a PLAY packet
    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)
    Deprecated, for removal: This API element is subject to removal in a future version.
    this method will eventually be removed, please migrate to the method supplying your own encoding/decoding codec.
  • Method Details

    • getSide

      Side getSide()
      Returns:
      the side
    • registerPacket

      @Deprecated(forRemoval=true) <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)
      Deprecated, for removal: This API element is subject to removal in a future version.
      this method will eventually be removed, please migrate to the method supplying your own encoding/decoding codec. Likely in 1.21.2 or 1.22.
      Packet Registration registers a PLAY packet
      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.
    • registerPacket

      <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)
      Packet Registration, registers a PLAY packet
      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.
    • registerConfigurationPacket

      <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)
      Packet Registration, registers a CONFIGURATION packet
      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.