Class Network

java.lang.Object
commonnetwork.api.Network

public class Network extends Object
  • Constructor Details

    • Network

      public Network()
  • Method Details

    • registerPacket

      public static <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> PacketRegistrar registerPacket(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type, net.minecraft.network.codec.StreamCodec<? extends net.minecraft.network.FriendlyByteBuf, T> codec, Consumer<PacketContext<T>> handler)
      Packet Registration
      Type Parameters:
      T - - The packet type
      Parameters:
      type - - The packet type.
      codec - - The StreamCodec.
      handler - - The handler method.
      Returns:
      The registrar for chaining registrations.
    • registerConfigurationPacket

      public static <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> PacketRegistrar registerConfigurationPacket(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type, net.minecraft.network.codec.StreamCodec<? extends net.minecraft.network.FriendlyByteBuf, T> codec, Consumer<PacketContext<T>> handler)
      Packet Registration for the CONFIGURATION phase.
      Type Parameters:
      T - - The packet type
      Parameters:
      type - - The packet type.
      codec - - The StreamCodec.
      handler - - The handler method.
      Returns:
      The registrar for chaining registrations.
    • getNetworkHandler

      public static NetworkHandler getNetworkHandler()
      Gets the Network handler for use to send packets.
      Returns:
      - The network handler