Class NeoForgeNetworkHandler

java.lang.Object
commonnetwork.networking.PacketRegistrationHandler
commonnetwork.networking.NeoForgeNetworkHandler
All Implemented Interfaces:
NetworkHandler, PacketRegistrar

public class NeoForgeNetworkHandler extends PacketRegistrationHandler
  • Constructor Details

    • NeoForgeNetworkHandler

      public NeoForgeNetworkHandler(Side side)
  • Method Details

    • onRegister

      protected <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> void onRegister(PacketContainer<T> container)
      Description copied from class: PacketRegistrationHandler
      Loader-specific wiring for a freshly-registered packet. May be a no-op if the loader defers registration to its own lifecycle event.
      Specified by:
      onRegister in class PacketRegistrationHandler
    • register

      public void register(net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent event)
    • sendToServer

      public <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> void sendToServer(T packet, boolean ignoreCheck)
      Description copied from interface: NetworkHandler
      Sends the packet to the server. Can ignore the check if the server has the packet registered. Likely use case for this is talking to bukkit/spigot/paper servers.
      Type Parameters:
      T - - The packet type
      Parameters:
      packet - - the packet
      ignoreCheck - - ignore the check if the server has the packet registered.
    • sendToClient

      public <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> void sendToClient(T packet, net.minecraft.server.level.ServerPlayer player, boolean ignoreCheck)
      Description copied from interface: NetworkHandler
      Sends the packet to the client player.
      Type Parameters:
      T - - The packet type
      Parameters:
      packet - - the packet
      player - - the player
      ignoreCheck - - ignore the check if the client has the packet registered.
    • send

      public <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> void send(T packet, net.minecraft.network.Connection connection)
      Description copied from interface: NetworkHandler
      Sends the packet to the connection.
      Type Parameters:
      T - - The packet type
      Parameters:
      packet - - the packet
      connection - - the connection