Class ForgeNetworkHandler

java.lang.Object
net.darkhax.bookshelf.forge.impl.network.ForgeNetworkHandler
All Implemented Interfaces:
INetworkHandler

public class ForgeNetworkHandler extends Object implements INetworkHandler
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canSendPacket(net.minecraft.server.level.ServerPlayer recipient, net.minecraft.resources.ResourceLocation payloadId)
    Tests if a payload type can be sent to a player.
    <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>
    void
    register(IPacket<T> packet)
    Registers a Bookshelf packet type to the packet registry.
    <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>
    void
    sendToPlayer(net.minecraft.server.level.ServerPlayer recipient, T payload)
    Sends a packet from the server to a player.
    <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>
    void
    sendToServer(T payload)
    Sends a payload from the client to the server.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.darkhax.bookshelf.common.api.network.INetworkHandler

    canSendPacket, canSendPacket
  • Constructor Details

    • ForgeNetworkHandler

      public ForgeNetworkHandler()
  • Method Details

    • register

      public <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> void register(IPacket<T> packet)
      Description copied from interface: INetworkHandler
      Registers a Bookshelf packet type to the packet registry.
      Specified by:
      register in interface INetworkHandler
      Type Parameters:
      T - The type of the payload.
      Parameters:
      packet - The packet type to register.
    • sendToServer

      public <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> void sendToServer(T payload)
      Description copied from interface: INetworkHandler
      Sends a payload from the client to the server.
      Specified by:
      sendToServer in interface INetworkHandler
      Type Parameters:
      T - The type of the payload.
      Parameters:
      payload - The payload to send.
    • sendToPlayer

      public <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> void sendToPlayer(net.minecraft.server.level.ServerPlayer recipient, T payload)
      Description copied from interface: INetworkHandler
      Sends a packet from the server to a player.
      Specified by:
      sendToPlayer in interface INetworkHandler
      Type Parameters:
      T - The type of the payload.
      Parameters:
      recipient - The recipient of the packet.
      payload - The payload to send.
    • canSendPacket

      public boolean canSendPacket(net.minecraft.server.level.ServerPlayer recipient, net.minecraft.resources.ResourceLocation payloadId)
      Description copied from interface: INetworkHandler
      Tests if a payload type can be sent to a player.
      Specified by:
      canSendPacket in interface INetworkHandler
      Parameters:
      recipient - The recipient of the packet.
      payloadId - The payload type ID.
      Returns:
      If the payload can be sent to the recipient player.