Interface AbstractPacket<T extends AbstractPacket<T>>

All Superinterfaces:
net.minecraft.network.protocol.common.custom.CustomPacketPayload
All Known Implementing Classes:
AreaPacket, BundleHashPacket, ClientboundDialoguePacket, ClientBoundExplorerPacket, CustomDataPacket, CutsceneCommandPacket, CutscenePacket, DialogueSavePacket, GiveItemPacket, LinearizeCutscenePacket, SavedDataSyncPacket, ScreenEffectPacket, ServerBoundChangeWeatherPacket, ServerboundDialoguePacket, ServerBoundExplorerPacket, ServerBoundSetTimePacket, ServerBoundSpawnEntityPacket, ServerBoundTeleportPacket, WaypointPacket

public interface AbstractPacket<T extends AbstractPacket<T>> extends net.minecraft.network.protocol.common.custom.CustomPacketPayload
Base interface for all network packets.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final record 
     

    Nested classes/interfaces inherited from interface net.minecraft.network.protocol.common.custom.CustomPacketPayload

    net.minecraft.network.protocol.common.custom.CustomPacketPayload.FallbackProvider<B>, net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T>, net.minecraft.network.protocol.common.custom.CustomPacketPayload.TypeAndCodec<B,T>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf, net.minecraft.nbt.CompoundTag>
    Bounded NBT codec with a generous quota for large editor/user payloads.
    static final int
    Maximum length for large file/resource content payloads.
    static final int
    Maximum element count for list fields in packet payloads.
    static final int
    Maximum module count for area packets.
    static final int
    Maximum length for user-supplied strings carried in packet payloads.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>
    net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T>
    createType(net.minecraft.resources.Identifier id)
     
     
    net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, T>
     
    net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T>
     
    default void
    handleClient(net.neoforged.neoforge.network.handling.IPayloadContext ctx)
     
    default void
    handleServer(net.neoforged.neoforge.network.handling.IPayloadContext ctx)
     
    static @Nullable net.minecraft.server.level.ServerPlayer
    serverPlayer(net.neoforged.neoforge.network.handling.IPayloadContext ctx)
    The server-side player that sent the payload, or null when the payload was received on a side without a player (e.g.
    default net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<? extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>
     

    Methods inherited from interface net.minecraft.network.protocol.common.custom.CustomPacketPayload

    toVanillaClientbound, toVanillaServerbound
  • Field Details

    • MAX_STRING_LENGTH

      static final int MAX_STRING_LENGTH
      Maximum length for user-supplied strings carried in packet payloads.
      See Also:
    • MAX_FILE_CONTENT_LENGTH

      static final int MAX_FILE_CONTENT_LENGTH
      Maximum length for large file/resource content payloads.
      See Also:
    • MAX_LIST_ELEMENT_COUNT

      static final int MAX_LIST_ELEMENT_COUNT
      Maximum element count for list fields in packet payloads.
      See Also:
    • MAX_MODULE_COUNT

      static final int MAX_MODULE_COUNT
      Maximum module count for area packets.
      See Also:
    • GENEROUS_NBT_CODEC

      static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf, net.minecraft.nbt.CompoundTag> GENEROUS_NBT_CODEC
      Bounded NBT codec with a generous quota for large editor/user payloads.
  • Method Details

    • createType

      static <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> createType(net.minecraft.resources.Identifier id)
    • serverPlayer

      static @Nullable net.minecraft.server.level.ServerPlayer serverPlayer(net.neoforged.neoforge.network.handling.IPayloadContext ctx)
      The server-side player that sent the payload, or null when the payload was received on a side without a player (e.g. dedicated server startup or client-bound traffic).
    • type

      default net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<? extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> type()
      Specified by:
      type in interface net.minecraft.network.protocol.common.custom.CustomPacketPayload
    • getType

      net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> getType()
    • getBoundTo

      PacketBounds getBoundTo()
    • getCodec

      net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, T> getCodec()
    • handleClient

      default void handleClient(net.neoforged.neoforge.network.handling.IPayloadContext ctx)
    • handleServer

      default void handleServer(net.neoforged.neoforge.network.handling.IPayloadContext ctx)