Class CommonPacketCodec

java.lang.Object
dev.munebase.dynamickeybinds.network.CommonPacketCodec

public final class CommonPacketCodec extends Object
Shared packet serialization helpers used by both loader networking layers.
  • Method Details

    • decodeSyncKeybinds

      public static SyncKeybindsPacket decodeSyncKeybinds(net.minecraft.network.FriendlyByteBuf buf)
      Decodes a sync keybinds packet from the buffer.
      Parameters:
      buf - The buffer to read from
      Returns:
      The decoded packet
    • encodeSyncKeybinds

      public static void encodeSyncKeybinds(net.minecraft.network.FriendlyByteBuf buf, List<StoredKeybind> keybinds)
      Encodes a list of keybinds into the buffer.
      Parameters:
      buf - The buffer to write to
      keybinds - The keybinds to encode
    • decodeAddKeybind

      public static AddKeybindPacket decodeAddKeybind(net.minecraft.network.FriendlyByteBuf buf)
      Decodes an add keybind packet from the buffer.
      Parameters:
      buf - The buffer to read from
      Returns:
      The decoded packet
    • encodeAddKeybind

      public static void encodeAddKeybind(AddKeybindPacket pkt, net.minecraft.network.FriendlyByteBuf buf)
      Encodes an add keybind packet into the buffer.
      Parameters:
      pkt - The packet to encode
      buf - The buffer to write to
    • decodeRemoveKeybind

      public static RemoveKeybindPacket decodeRemoveKeybind(net.minecraft.network.FriendlyByteBuf buf)
      Decodes a remove keybind packet from the buffer.
      Parameters:
      buf - The buffer to read from
      Returns:
      The decoded packet
    • encodeRemoveKeybind

      public static void encodeRemoveKeybind(RemoveKeybindPacket pkt, net.minecraft.network.FriendlyByteBuf buf)
      Encodes a remove keybind packet into the buffer.
      Parameters:
      pkt - The packet to encode
      buf - The buffer to write to
    • decodeUpdateKeybind

      public static UpdateKeybindPacket decodeUpdateKeybind(net.minecraft.network.FriendlyByteBuf buf)
      Decodes an update keybind packet from the buffer.
      Parameters:
      buf - The buffer to read from
      Returns:
      The decoded packet
    • encodeUpdateKeybind

      public static void encodeUpdateKeybind(UpdateKeybindPacket pkt, net.minecraft.network.FriendlyByteBuf buf)
      Encodes an update keybind packet into the buffer.
      Parameters:
      pkt - The packet to encode
      buf - The buffer to write to